Table of Contents

Class DieAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

An action that is invoked when a PersonLike should Die(DeathReason). All default DeathReason values are handled by this action. To enqueue this action efficiently, use Enqueue(PersonLike, DeathReason).

public class DieAction : Action, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
DieAction
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

DieAction(ActionType, ActionInfo)

Creates a new action with the given action information.

public DieAction(ActionType type, ActionInfo info)

Parameters

type ActionType

The type for this action.

info ActionInfo

The information for this action.

Fields

Reason

The reason of death

[DataMember]
public DeathReason Reason

Field Value

DeathReason

Methods

CanCancel(Action)

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

Parameters

cancelSource Action

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

Returns

bool

true if the action can be canceled

CanEnqueueConversation(PersonLike, ActionType)

Returns true if the given person can (automatically) enqueue a social action with the Person that is executing this action. Note that enqueueing a social action manually is still possible even if this method returns false. By default, only SleepAction returns false on this method.

public override bool CanEnqueueConversation(PersonLike person, ActionType type)

Parameters

person PersonLike

The person that wants to converse with us.

type ActionType

The type of action that should be enqueued. Might be null, in which case a generic or unknown action is querying this function.

Returns

bool

Whether or not enqueueing a social action is possible.

Enqueue(PersonLike, DeathReason)

Enqueues a DieAction for the given PersonLike. The enqueued action receives priority, and all other current actions are canceled.

public static void Enqueue(PersonLike person, DeathReason reason)

Parameters

person PersonLike

The person that should die

reason DeathReason

The reason for their death

GetDisplayName()

Returns a localized string that explains this action in short. By default, this method returns GetDisplayName(ActionInfo, bool).

public override string GetDisplayName()

Returns

string

This action's display name

Initialize()

This method is called when the action is first started by a Person. Note that it is not called when the action gets added to the ActionQueue, but when it is moved to CurrentActions.

public override void Initialize()

IsCompleted()

This method is called every update frame by a Person if this action is currently active to check if it should be stopped. If this returns a result other than Completed, OnCompleted(CompletionType) will be called and the action is stopped. By default, only ForceResult modifies the completion type, otherwise Active is returned.

public override CompletionType IsCompleted()

Returns

CompletionType

The current completion type of this action

OnCompleted(CompletionType)

This method is called when this action IsCompleted(), or if it is canceled from an outside source. Note that, if this method is called as a result of IsCompleted(), the CompletionType passed will be the same. By default, only OnActionCompleted(Action, CompletionType, bool) is called.

public override void OnCompleted(CompletionType type)

Parameters

type CompletionType

The type that this action completed with

Update(GameTime, TimeSpan, float)

This method is called every update frame if this action is currently active. By default, only the ElapsedTime is modified in this method and ActionUpdate(Action, GameTime, TimeSpan, float, bool) is called.

public override void Update(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