Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 00089 00090 |
//===================================================================== // AI_CommonSenseSensorAction // Updates sensors related to common sense actions/goals //===================================================================== class AI_CommonSenseSensorAction extends AI_SensorCharacterAction; //===================================================================== // Constants //===================================================================== // Variables var AI_GetOutOfWaySensor getOutOfWaySensor; // gets updated by setValue calls, not in a sensor action var AI_PainSensor painSensor; // this one, too var AI_EnemySensor enemySensor; // this one gets updated by callbacks on the sensor var AI_DodgeSensor dodgeSensor; // ditto var AI_TargetSensor targetSensor; // and ditto var AI_TargetMemorySensor targetMemorySensor; // (a targetSensor that remembers a lost target for a while...) var AI_ReactToFireSensor reactToFireSensor; // and double ditto 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 AI_GuardSensor guardSensor; // this one gets updated by callbacks on the sensor 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 getOutOfWaySensor = AI_GetOutOfWaySensor(addSensorClass( class'AI_GetOutOfWaySensor' )); painSensor = AI_PainSensor(addSensorClass( class'AI_PainSensor' )); enemySensor = AI_EnemySensor(addSensorClass( class'AI_EnemySensor' )); dodgeSensor = AI_DodgeSensor(addSensorClass( class'AI_DodgeSensor' )); targetSensor = AI_TargetSensor(addSensorClass( class'AI_TargetSensor' )); targetMemorySensor= AI_TargetMemorySensor(addSensorClass( class'AI_TargetMemorySensor' )); reactToFireSensor = AI_ReactToFireSensor(addSensorClass( class'AI_ReactToFireSensor' )); nearMissSensor = AI_NearMissSensor(addSensorClass( class'AI_NearMissSensor' )); guardSensor = AI_GuardSensor(addSensorClass( class'AI_GuardSensor' )); // 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 = rook().Spawn( class'NearMissCollisionVolume' ); fatVolume.pawn = rook(); fatVolume.nearMissSensor = nearMissSensor; fatVolume.Move( rook().Location - fatVolume.Location ); } function cleanup() { super.cleanup(); if ( fatVolume != None ) { fatVolume.Destroy(); fatVolume = None; } } //===================================================================== // State Code state Running { Begin: while ( true ) { // update fatVolume location if ( nearMissSensor.queryUsage() > 0 && rook().Location != fatVolume.Location ) fatVolume.Move( rook().Location - fatVolume.Location ); yield(); } } //===================================================================== defaultproperties { } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |