class TameariaCitizen extends AIController;
var PawnPathController CurrentPathController;
var int CurrentPathPointNum, CurrentPathNum;
function Possess(Pawn aPawn)
{
super.Possess(aPawn);
if(TameariaCitizenPawn(aPawn) != none && TameariaCitizenPawn(aPawn).InitialPathController != none)
{
CurrentPathController = TameariaCitizenPawn(aPawn).InitialPathController;
SetTimer(CurrentPathController.PauseHereTime,false);
}
}
function Timer()
{
if(CurrentPathController.Paths.Length > 0)
CurrentPathNum = Rand(CurrentPathController.Paths.Length);
else
CurrentPathNum = -1;
CurrentPathPointNum = 0;
if(Pawn != none)
Pawn.SetPhysics(PHYS_Walking);
GoToState('Moving');
}
state WaitingToMove
{
function PlayerWantsToTalk()
{
PreviousState = 'WaitingToMove';
GoToState('InteractingWithPlayer');
}
Begin:
SetTimer(CurrentPathController.PauseHereTime,false);
}
state Idle
{
Begin:
MoveTo(Pawn.Location);
}
state Moving
{
function SetMoveTarget()
{
local Actor NextMoveTarget;
if(CurrentPathPointNum < CurrentPathController.Paths[CurrentPathNum].PathPoints.Length)
NextMoveTarget = CurrentPathController.Paths[CurrentPathNum].PathPoints[CurrentPathPointNum].Point;
else
GoToState('WaitingToMove');
if ( NextMoveTarget == None )
{
CurrentPathController = CurrentPathController.Paths[CurrentPathNum].PathEndController;
CurrentPathPointNum = 0;
GoToState('WaitingToMove');
return;
}
MoveTarget = NextMoveTarget;
}
Begin:
SetMoveTarget();
if ( (MoveTarget != None) && (MoveTarget != Pawn) )
{
MoveToward(MoveTarget,,,,True);
Focus = none;
if ((MoveTarget != CurrentPathController.Paths[CurrentPathNum].PathPoints[CurrentPathPointNum].Point)
|| !Pawn.ReachedDestination(CurrentPathController.Paths[CurrentPathNum].PathPoints[CurrentPathPointNum].Point))
Goto('Begin');
}
CurrentPathPointNum++;
Goto('Begin');
}
defaultproperties
{
}