GoHereAction - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Actions

GoHereAction Class

A go here action is an action that uses two underlying actions for its execution: an action where a person walks to a goal and an action where a person drives to a goal.
This is the action class used by TinyLife.Actions.ActionType.GoHere.

public class GoHereAction : TinyLife.Actions.MultiAction

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Action 🡒 MultiAction 🡒 GoHereAction

Constructors

GoHereAction.GoHereAction(ActionType, ActionInfo) Constructor

Creates a new action from the given ActionType

public GoHereAction(TinyLife.Actions.ActionType type, TinyLife.Actions.ActionInfo info);

Parameters

type ActionType
The type to create this action from

info ActionInfo
The information for this action

Methods

GoHereAction.AndThenInitialize() Method

Initializes the main action.
This method is called after FirstActions have all completed.

protected override void AndThenInitialize();

GoHereAction.AndThenIsCompleted() Method

MultiAction version of IsCompleted().
This method returns whether or not the main action is completed.

protected override TinyLife.Actions.Action.CompletionType AndThenIsCompleted();

Returns

CompletionType
Whether the main action is completed

GoHereAction.CanCancel(Action) Method

Returns whether or not this action can be canceled by the given outside source.
Note that the outside source can be null, and if it is, it means that the player canceled the action manually.
By default, actions can only be canceled if the cancelSource is null.

public override bool CanCancel(TinyLife.Actions.Action cancelSource);

Parameters

cancelSource Action
The source of the cancelation, or null if the player canceled it

Returns

System.Boolean
true if the action can be canceled

GoHereAction.CreateFirstActions() Method

Return a set of actions that should be executed before this action.
Even if the yield statement is used, all actions will be collected into a list at the start of this action's invocation.
If no action gets returned in this function, this action fails.
If a null action is returned as the first item, no first actions will be executed.

protected override System.Collections.Generic.IEnumerable<TinyLife.Actions.Action> CreateFirstActions();

Returns

System.Collections.Generic.IEnumerable<Action>
A set of actions that sohuld run before this action

GoHereAction.ShouldFail(Action, CompletionType) Method

A method that returns whether or not this main action should fail if the previous or next completedAction completed with the given completion.
By default, this method returns true only if completion is not Completed.

protected override bool ShouldFail(TinyLife.Actions.Action completedAction, TinyLife.Actions.Action.CompletionType completion);

Parameters

completedAction Action
The action that has completed

completion CompletionType
The completion type of the action

Returns

System.Boolean
true if we should fail due to this completion