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

Tyrion.AI_Panic


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
//=====================================================================
// AI_Panic
//=====================================================================

class AI_Panic extends AI_CharacterAction
	editinlinenew;

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

const MAX_ITERATIONS = 10;			// number of random locations to consider
const MAX_PANIC_DIST = 3000.0f;		// max dist to run
const MIN_PANIC_DIST = 1000.0f;		// min dist to run

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

var BaseAICharacter ai;
var int i;
var Vector destination;

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

//=====================================================================
// State code

state Running
{
Begin:
	ai = BaseAICharacter(pawn);

	if ( ai.logTyrion )
		log( name @ "started." @ ai.name @ "is PANICKING!" );

	ai.level.speechManager.PlayDynamicSpeech( ai, 'Panic' );
	useResources( class'AI_Resource'.const.RU_ARMS );		// don't use weapons while panicked!

	// find a place to run to...
	do
	{
		destination = AI_Controller(ai.controller).getRandomLocation( ai, ai.Location, MAX_PANIC_DIST, MIN_PANIC_DIST );
	}
	until ( ++i >= MAX_ITERATIONS || destination != ai.Location );

	//you can also play a one shot anim on the upper body:
	//	character.playUpperBodyAnimation("a_panic");

	ai.loopUpperBodyAnimation("a_panic");

	waitForGoal( (new class'AI_MoveToGoal'( movementResource(), achievingGoal.priority, destination )).postGoal( self ), true );

	ai.stopUpperBodyAnimation();

	if ( ai.logTyrion )
		log( name @ "(" @ ai.name @ ") stopped." );

	succeed();
}

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

defaultproperties
{
	satisfiesGoal = class'AI_PanicGoal'
}

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