DieAction - Ellpeck/TinyLifeExampleMod Wiki
public class DieAction : TinyLife.Actions.Action
DieAction.DieAction(ActionType, ActionInfo) Constructor
Creates a new action from the given ActionType
public DieAction(TinyLife.Actions.ActionType type, TinyLife.Actions.ActionInfo info);
The type to create this action from
The information for this action
The reason of death
public DeathReason Reason;
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(TinyLife.Actions.Action cancelSource);
The source of the cancelation, or null if the player canceled it
true if the action can be canceled
DieAction.CanEnqueueConversation(Person, ActionType) Method
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 TinyLife.Actions.SleepAction returns false on this method.
protected override bool CanEnqueueConversation(TinyLife.Objects.Person person, TinyLife.Actions.ActionType type);
The person that wants to converse with us
The type of action that should be enqueued
Whether or not enqueueing a social action is possible
DieAction.Enqueue(Person, DeathReason) Method
public static void Enqueue(TinyLife.Objects.Person person, TinyLife.Objects.Person.DeathReason reason);
The person that should die
The reason for their death
Returns a localized string that explains this action in short.
By default, this method returns GetDisplayName(ActionInfo, bool).
public override string GetDisplayName();
This action's display name
public override void Initialize();
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 ForceFail modifies the completion type, otherwise Active is returned.
public override TinyLife.Actions.Action.CompletionType IsCompleted();
The current completion type of this action
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.
public override void OnCompleted(TinyLife.Actions.Action.CompletionType type);
The type that this action completed with
DieAction.Update(GameTime, TimeSpan, GameSpeed) Method
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, GameSpeed, bool) is called.
public override void Update(Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed);
The current game time
The amount of time that has passed, in game time
The game's current speed setting