Table of Contents

Class WatchTvAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

Watch tv action is the action that is created by the 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 : MultiAction, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
WatchTvAction
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

WatchTvAction(ActionType, ActionInfo, Channel)

public WatchTvAction(ActionType type, ActionInfo info, WatchTvAction.Channel channel)

Parameters

type ActionType
info ActionInfo
channel WatchTvAction.Channel

Properties

FullyInProgress

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 property is true if InProgressTime is greater than Zero.

public override bool FullyInProgress { get; }

Property Value

bool

Whether this action is fully in progress

Methods

AndThenIsCompleted()

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

protected override CompletionType AndThenIsCompleted()

Returns

CompletionType

Whether the main action is completed

AndThenOnCompleted(CompletionType)

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

protected override void AndThenOnCompleted(CompletionType type)

Parameters

type CompletionType

The completion of the main action

AndThenUpdate(GameTime, TimeSpan, float)

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

protected override void AndThenUpdate(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

CanMultitask(Action)

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(Action other)

Parameters

other Action

The action to multi-task with

Returns

bool

Whether this action can be multi-tasked

CreateFirstActions()

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 the returned set only contains null items, no first actions will be executed.

protected override IEnumerable<Action> CreateFirstActions()

Returns

IEnumerable<Action>

A set of actions that should run before this action

GetSeating(Person, Furniture, int)

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

public static Furniture GetSeating(Person person, Furniture tv, int range = 5)

Parameters

person Person

The person that wants to sit

tv Furniture

The tv whose screen should be visible

range int

The range of the viewing area, or 5 by default

Returns

Furniture

A seat, or null if there is none

GetViewers(Furniture, int)

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

public static IEnumerable<Person> GetViewers(Furniture tv, int range = 5)

Parameters

tv Furniture

The tv

range int

The range of the viewing area, or 5 by default

Returns

IEnumerable<Person>

Everyone watching the tv

GetViewingArea(Furniture, int)

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 IEnumerable<Point> GetViewingArea(Furniture tv, int range = 5)

Parameters

tv Furniture

The tv whose screen should be visible

range int

The range of the viewing area, or 5 by default

Returns

IEnumerable<Point>

The viewing area of the tv