SinkAction - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Actions

SinkAction Class

An action that is invoked at a Sink.
If the sink is not the main GetActionObject<T>(), it should be added as an auxiliary object using AddAuxiliaryObject(MapObject, ActionSpot) in AndThenInitialize().
This action automatically displays a running water sound and sets the active person's pose to a working version using ToWorking(Pose).

public abstract class SinkAction : TinyLife.Actions.MultiAction

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

Constructors

SinkAction.SinkAction(ActionType, ActionInfo) Constructor

Creates a new action from the given ActionType

public SinkAction(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

SinkAction.AndThenInitialize() Method

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

protected override void AndThenInitialize();

SinkAction.AndThenOnCompleted(CompletionType) Method

MultiAction version of OnCompleted(CompletionType).
This method gets called when the main action completes.
This is also called before CreateNextActions(CompletionType) is called.

protected override void AndThenOnCompleted(TinyLife.Actions.Action.CompletionType type);

Parameters

type CompletionType
The completion of the main action

SinkAction.AndThenUpdate(GameTime, TimeSpan, GameSpeed) Method

MultiAction version of Update(GameTime, TimeSpan, GameSpeed).
This method is called every update frame while the main action is active.
By default, only MainElapsedTime is increased.

protected override void AndThenUpdate(Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed);

Parameters

time Microsoft.Xna.Framework.GameTime
The current game time

passedInGame System.TimeSpan
The amount of time that has passed, in game time

speed GameSpeed
The game's speed

SinkAction.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