Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Tyrion.AI_VehicleSensorAction


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
//=====================================================================
// AI_VehicleSensorAction
// Updates sensors related to vehicles
//=====================================================================

class AI_VehicleSensorAction extends AI_SensorAction;

//=====================================================================
// Constants

//=====================================================================
// Variables

var AI_GuardSensor			guardSensor;		// this one gets updated by callbacks on the sensor
var AI_EnemySensor			enemySensor;		// this one gets updated by callbacks on the sensor
var AI_TargetSensor			targetSensor;		// this one gets updated by callbacks on the sensor
var AI_TargetMemorySensor	targetMemorySensor;	// (a targetSensor that remembers a lost target for a while...)
var AI_ReactToFireSensor	reactToFireSensor;	// this one gets updated by callbacks on the sensor
var AI_PainSensor			painSensor;			// this one, too
var AI_NearMissSensor		nearMissSensor;		// this one gets updated by setValue calls again (Touch function in NearMissCollisionVolume); however, it requires periodic update of the nearMissCollisionVolume

var NearMissCollisionVolume fatVolume;

//=====================================================================
// Functions

//---------------------------------------------------------------------
// set up the sensors this action may update

function setupSensors( AI_Resource resource )
{
	// construct all sensors, add them to resource's sensor list
	guardSensor		  = AI_GuardSensor(addSensorClass( class'AI_GuardSensor' ));
	enemySensor		  = AI_EnemySensor(addSensorClass( class'AI_EnemySensor' ));
	targetSensor	  = AI_TargetSensor(addSensorClass( class'AI_TargetSensor' ));
	targetMemorySensor= AI_TargetMemorySensor(addSensorClass( class'AI_TargetMemorySensor' ));
	reactToFireSensor = AI_ReactToFireSensor(addSensorClass( class'AI_ReactToFireSensor' ));
	painSensor        = AI_PainSensor(addSensorClass( class'AI_PainSensor' ));
	nearMissSensor	  = AI_NearMissSensor(addSensorClass( class'AI_NearMissSensor' ));

	// repeat if there are more sensors this sensorAction updates
}

//---------------------------------------------------------------------

function begin()
{
	// Create a larger collision volume around the character to detect near misses
	if ( fatVolume == None )
		fatVolume = resource.pawn().Spawn( class'NearMissCollisionVolume' );
	fatVolume.pawn = resource.pawn();
	fatVolume.nearMissSensor = nearMissSensor;
	fatVolume.Move( resource.pawn().Location - fatVolume.Location );
}

function cleanup()
{
	super.cleanup();

	if ( fatVolume != None )
	{
		fatVolume.Destroy();
		fatVolume = None;
	}
}

//---------------------------------------------------------------------
// Return the resource class for this action

static function class<Tyrion_ResourceBase> getResourceClass()
{
	return class'AI_VehicleResource';
}

//=====================================================================
// State Code

state Running
{
Begin:
	pause();	// NearMissSensor's fatVolume only used on turrets so doesn't need to be updated
}

//=====================================================================

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 15:54:30.000 - Creation time: st 23.5.2018 00:10:42.107 - Created with UnCodeX