Table of Contents

Class TryMultipleAction

Namespace
TinyLife.Actions
Assembly
TinyLife.dll

An action type that can be extended to try multiple underlying actions until there are no more actions to try, or until one of them succeeds. This action is the underlying class used by TryGoHereAction.

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

Constructors

TryMultipleAction(ActionInfo)

Creates a new typeless action with the given action information.

public TryMultipleAction(ActionInfo info)

Parameters

info ActionInfo

The information for this action.

TryMultipleAction(ActionType, ActionInfo)

Creates a new action with the given action information.

public TryMultipleAction(ActionType type, ActionInfo info)

Parameters

type ActionType

The type for this action.

info ActionInfo

The information for this action.

Methods

GetNextActionToTry()

Create and return an instance of the next action to try. If this action completes successfully, this action also completes successfully. If this method returns null, it causes this action to fail.

public abstract Action GetNextActionToTry()

Returns

Action

The next action to try, or null to give up.

Initialize()

This method is called when the action is first started by a Person. Note that it is not called when the action gets added to the ActionQueue, but when it is moved to CurrentActions.

public override void Initialize()

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(PersonLike, AppliedMigrations)

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(PersonLike person, AppliedMigrations appliedMigrations)

Parameters

person PersonLike

The person that this action belongs to

appliedMigrations AppliedMigrations

The migrations that have been applied so far

Returns

bool

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