Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# Tyrion.AI_GuardMovement

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

    //=====================================================================
    // AI_GuardMovement
    // Handles non-attack related movement for Guard
    //=====================================================================

    class AI_GuardMovement extends AI_MovementAction
    	editinlinenew;

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

    var(InternalParameters) editconst Vector movementAreaCenter;

    var Rotator terminalRotation;

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

    //---------------------------------------------------------------------
    // Selection Heuristic
    // Returns a value in the range [0, 1], indicating how suitable this action is for achieving this goal

    static function float selectionHeuristic( AI_Goal goal )
    {
    	if ( AI_GuardMovementGoal(goal).movementAreaCenter == goal.resource.pawn().Location )
    		return 0.0f;		// haven't moved from center - don't match
    	else
    		return 1.0f;
    }

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

    state Running
    {
    Begin:
    	// return to movement area center
    	if ( resource.pawn().logTyrion )
    		log( name @ "(" @ resource.pawn().name @ ") moving back to movementAreaCenter:" @ movementAreaCenter );

    	// turn to enemy after moving if engaged with an enemy
    	if ( AI_Guard(achievingGoal.parentAction).lastGuardTarget != None )
    		terminalRotation = Rotator(AI_Guard(achievingGoal.parentAction).lastGuardTarget.Location - resource.pawn().Location);

    	WaitForGoal( (new class'AI_MoveToGoal'( movementResource(), achievingGoal.priorityFn()-1, movementAreaCenter,
    		,, GM_RUN,,,,,, terminalRotation )).postGoal( self ) );

    	succeed();
    }

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

    defaultproperties
    {
    	satisfiesGoal = class'AI_GuardMovementGoal'
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
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.286 - Created with UnCodeX