Table of Contents

Class DriveAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

A drive action is the action that gets executed by GoHere if the distance long enough to drive. This action involves a Tiny getting into a Vehicle that this action spawns, driving on a road and then exiting and deleting the Vehicle.

public class DriveAction : PathfindAction, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
DriveAction
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

DriveAction(ActionInfo)

Creates a new typeless action with the given action information.

public DriveAction(ActionInfo info)

Parameters

info ActionInfo

The information for this action.

Methods

FindPath(ICollection<(Point Pos, int Floor)>)

A method called by Initialize() to start finding a path to the given goal location.

protected override Task<Stack<(Vector2 Pos, float Floor)>> FindPath(ICollection<(Point Pos, int Floor)> goals)

Parameters

goals ICollection<(Point Pos, int Floor)>

The goal locations

Returns

Task<Stack<(Vector2 Pos, float Floor)>>

A task that, when finished, returns a path

GetSpeed()

Returns the speed that the PersonLike should traverse with.

protected override float GetSpeed()

Returns

float

The speed

IsCompleted()

This method is called every update frame by a Person if this action is currently active to check if it should be stopped. If this returns a result other than Completed, OnCompleted(CompletionType) will be called and the action is stopped. By default, only ForceResult modifies the completion type, otherwise Active is returned.

public override CompletionType IsCompleted()

Returns

CompletionType

The current completion type of this action

OnCompleted(CompletionType)

This method is called when this action IsCompleted(), or if it is canceled from an outside source. Note that, if this method is called as a result of IsCompleted(), the CompletionType passed will be the same. By default, only OnActionCompleted(Action, CompletionType, bool) is called.

public override void OnCompleted(CompletionType type)

Parameters

type CompletionType

The type that this action completed with

OnPathReady()

This method is called right before the PathReady variable is set to true. At the point of this method being called, Path will have a value.

protected override void OnPathReady()

Update(GameTime, TimeSpan, float)

This method is called every update frame if this action is currently active. By default, only the ElapsedTime is modified in this method and ActionUpdate(Action, GameTime, TimeSpan, float, bool) is called.

public override void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)

Parameters

time GameTime

The current game time

passedInGame TimeSpan

The amount of time that has passed, in game time

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed