WatchTvAction - Ellpeck/TinyLifeExampleMod Wiki

Original URL:

Tiny Life


WatchTvAction Class

Watch tv action is the action that is created by the TinyLife.Actions.ActionType.WatchTv action types.
This action class is exposed as its behavior is rather complex, taking into account the possible locations that a person can stand or sit while watching TV.
See GetViewers(Furniture, int), GetViewingArea(Furniture, int) and GetSeating(Person, Furniture, int) for more information.

public class WatchTvAction : TinyLife.Actions.MultiAction

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


WatchTvAction.AndThenInitialize() Method

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

protected override void AndThenInitialize();

WatchTvAction.AndThenIsCompleted() Method

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

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


Whether the main action is completed

WatchTvAction.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);


type CompletionType
The completion of the main action

WatchTvAction.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);


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

WatchTvAction.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);


other Action
The action to multi-task with


Whether this action can be multi-tasked

WatchTvAction.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();


A set of actions that sohuld run before this action

WatchTvAction.GetSeating(Person, Furniture, int) Method

Returns a furniture object that has the Chair category and that is in the GetViewingArea(Furniture, int) of the given tv

public static TinyLife.Objects.Furniture GetSeating(TinyLife.Objects.Person person, TinyLife.Objects.Furniture tv, int range=5);


person Person
The person that wants to sit

tv Furniture
The tv whose screen should be visible

range System.Int32
The range of the viewing area, or 5 by default


A seat, or null if there is none

WatchTvAction.GetViewers(Furniture, int) Method

Returns a set of Person instances that are currently executing an action that extends WatchTvAction on the given tv

public static System.Collections.Generic.IEnumerable<TinyLife.Objects.Person> GetViewers(TinyLife.Objects.Furniture tv, int range=5);


tv Furniture
The tv

range System.Int32
The range of the viewing area, or 5 by default


Everyone watching the tv

WatchTvAction.GetViewingArea(Furniture, int) Method

Returns a rectangle in world space that represents all possible positions for a Person to stand or sit so they can see a tv's screen

public static MLEM.Misc.RectangleF GetViewingArea(TinyLife.Objects.Furniture tv, int range=5);


tv Furniture
The tv whose screen should be visible

range System.Int32
The range of the viewing area, or 5 by default


The viewing area of the tv

WatchTvAction.IsFullyInProgress() Method

Returns whether this action is currently "properly" in progress.
This is used by MultiAction and SocialAction and returns true only once the first actions are completed or the conversation has started, respectively.
By default, this method returns true if GetInProgressTime() is greater than System.TimeSpan.Zero.

public override bool IsFullyInProgress();


Whether this action is fully in progress