SitAction - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Actions

SitAction Class

A sit action is an action in which someone perpetually sits on an object while the action is being executed.
This action is the base class used for TinyLife.Actions.ActionType.SitToilet's action class.
Note that, for desk object interactions and interactions with movable held items, WorkAtDeskObjectAction or GetAndSitDownAction should be used instead.

public class SitAction : TinyLife.Actions.MultiAction

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

Constructors

SitAction.SitAction(ActionType, ActionInfo) Constructor

Creates a new action from the given ActionType

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

SitAction.AndThenInitialize() Method

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

protected override void AndThenInitialize();

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

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

SitAction.CanMultitask(Action) Method

Return true on this method if this action can be multi-tasked along with the passed Action.
To actually check this property, CanMultitask(Action, Action) should be used as it compares both objects.
A multi-tasking is an action that is currently active along with another action.
By default, multi-tasking is disallowed for any action.

public override bool CanMultitask(TinyLife.Actions.Action other);

Parameters

other Action
The action to multi-task with

Returns

System.Boolean
Whether this action can be multi-tasked

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