Class OutOfTownAction
An out-of-town action is an action where the PersonLike finds the closest exit road and then exits the city using that road. Out-of-town actions are things like going to work, where the destination location isn't visible to the player.
public abstract class OutOfTownAction : MultiAction, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderOutOfTownAction
- Implements
-
IGenericDataHolder
- Derived
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
OutOfTownAction(ActionInfo, bool, bool, params NeedType[])
Creates a new out-of-town action with the given settings. Note that, since some data is not saved to disk, all of the information should be provided by a subclass constructor.
public OutOfTownAction(ActionInfo info, bool discardHeldItemFirst, bool restoreNeedsEqually, params NeedType[] needsToTakeCareOf)
Parameters
info
ActionInfoThe action info
discardHeldItemFirst
boolWhether a DiscardHeldItemAction should be enqueued and executed before leaving town.
restoreNeedsEqually
boolWhether all needs should be restored equally. If this is true, all specified needs will be restored perpetually instead of just low ones.
needsToTakeCareOf
NeedType[]The needs that should automatically be taken care of
OutOfTownAction(ActionType, ActionInfo, bool, bool, params NeedType[])
Creates a new out-of-town action with the given settings. Note that, since some data is not saved to disk, all of the information should be provided by a subclass constructor.
public OutOfTownAction(ActionType type, ActionInfo info, bool discardHeldItemFirst, bool restoreNeedsEqually, params NeedType[] needsToTakeCareOf)
Parameters
type
ActionTypeThe action type
info
ActionInfoThe action info
discardHeldItemFirst
boolWhether a DiscardHeldItemAction should be enqueued and executed before leaving town.
restoreNeedsEqually
boolWhether all needs should be restored equally. If this is true, all specified needs will be restored perpetually instead of just low ones.
needsToTakeCareOf
NeedType[]The needs that should automatically be taken care of
Fields
NeedsToTakeCareOf
The needs that should automatically be taken care of while the person is out of town. A need gets taken care of in AndThenUpdate(GameTime, TimeSpan, float) if it is below 35%. Note that this value is not saved to disk, and should be provided by a subclass constructor.
protected readonly NeedType[] NeedsToTakeCareOf
Field Value
- NeedType[]
Methods
AndThenInitialize()
Initializes the main action. This method is called after Handler has all completed.
protected override void AndThenInitialize()
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
GameTimeThe current game time
passedInGame
TimeSpanThe amount of time that has passed, in game time
speedMultiplier
floatThe game speed multiplier, which represents how fast things should happen, which is usually determined by Speed
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 TinyLife.Actions.SleepAction returns false on this method.
public override bool CanEnqueueConversation(PersonLike person, ActionType type)
Parameters
person
PersonLikeThe person that wants to converse with us.
type
ActionTypeThe 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.
CausesExtremelyFastSpeed()
Returns true if this action, while it is currently active, should cause the ExtremelyFast speed to be available. By default, this method returns false.
public override bool CausesExtremelyFastSpeed()
Returns
- bool
Whether the extremely fast speed should be available
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
GetNextAction(CompletionType)
Returns an action that should be queued up immediately after this action completes. The queued up action is immediately started in the slot that this action occupied. Can be null, and is null by default.
public override Action GetNextAction(CompletionType completion)
Parameters
completion
CompletionTypeThe type that this action completed with
Returns
- Action
The follow-up action