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

Tyrion.CarMoveToLocation


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
class CarMoveToLocation extends NS_Action;

var vector destination;
var float desiredSpeed;

var Controller.FindPathAIProperties workAIProperties;

var array<Actor> ignore;

// Sets action parameters and starts action.
static function CarMoveToLocation startAction(AI_Controller c, ActionBase parent, vector destination, float desiredSpeed)
{
	local CarMoveToLocation action;

	// create new object
	action = new(c.level.Outer) class'CarMoveToLocation'(c, parent);

	// set action parameters
	action.destination = destination;
	action.desiredSpeed = desiredSpeed;

	action.runAction();
	return action;
}

state Running
{
Begin:
	if (controller.Pawn.logNavigationSystem)
		log( name @ "(" @ controller.Pawn.name @ "): move to" @ destination @ "started" );

	workAIProperties.roadBased = true;

	controller.findPath(controller.Pawn.Location, destination, workAIProperties, ignore, controller.Pawn.logNavigationSystem);

	// wait for find path to complete
	while (class'Pawn'.static.checkAlive(controller.pawn) && !controller.isFindPathComplete())
	{
		sleep(0.0);
	}

	// handle case of death while waiting
	if (class'Pawn'.static.checkDead(controller.pawn))
		fail(ACT_ALL_RESOURCES_DIED);

	controller.getFindPathResult();
	controller.discardFindPath();

	// move along wapoints
	waitForAction(class'CarMoveAlongWaypoints'.static.startAction(controller, self, desiredSpeed));

	// put hand brake on
	if (Buggy(controller.pawn) != None)
		Buggy(controller.pawn).diveInput = true;

	// fail and propagate error if failure
	if (errorCode != ACT_SUCCESS)
	{
		fail(errorCode);
	}

	succeed();
}

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