Table of Contents

Class PathfindToPersonAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

An Action that causes the underlying Person to pathfind to another person repeatedly until they have reached them, or until GetMaxPathfindTime() is up. This action is used by SocialAction.

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

Constructors

PathfindToPersonAction(ActionInfo)

Creates a new typeless action with the given action information.

[JsonConstructor]
public PathfindToPersonAction(ActionInfo info)

Parameters

info ActionInfo

The information for this action.

PathfindToPersonAction(ActionType, ActionInfo)

Creates a new action with the given action information.

public PathfindToPersonAction(ActionType type, ActionInfo info)

Parameters

type ActionType

The type for this action.

info ActionInfo

The information for this action.

Fields

DriveSpeedMultiplier

The speed multiplier that is passed to this action's underlying GoHereAction's DriveSpeedMultiplier. By default, this value is set to 1.

[DataMember]
public float DriveSpeedMultiplier

Field Value

float

WalkSpeedMultiplier

The speed multiplier that is passed to this action's underlying GoHereAction's WalkSpeedMultiplier. By default, this value is set to 1.

[DataMember]
public float WalkSpeedMultiplier

Field Value

float

Properties

Target

The target to pathfind to.

protected Person Target { get; }

Property Value

Person

Methods

GetMaxPathfindTime()

Returns the maximum amount of time that this action should run for before it is canceled. By default, 15 minutes are returned if this action was StartedAutomatically, or 1 hour if this action was started manually.

protected virtual TimeSpan GetMaxPathfindTime()

Returns

TimeSpan

The maximum amount of time before this action is canceled

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

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

Validate(Person)

Validates this action's data. This is called when a map is loaded from disk. When returning false on this method, the action is removed from the Person.

public override bool Validate(Person person)

Parameters

person Person

The person that this action belongs to

Returns

bool

Whether or not the action is still valid (or if it has invalid data)