Class WorkAction
A work action is the action that is used for Job instances when a person goes to work
public class WorkAction : OutOfTownAction, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderWorkAction
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
WorkAction(ActionType, ActionInfo)
public WorkAction(ActionType type, ActionInfo info)
Parameters
typeActionTypeinfoActionInfo
Properties
Job
The job that this work action is working at.
public Job Job { get; }
Property Value
Methods
AndThenInitialize()
Initializes the main action. This method is called after Handler has all completed.
protected override void AndThenInitialize()
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
typeCompletionTypeThe 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
timeGameTimeThe current game time
passedInGameTimeSpanThe amount of time that has passed, in game time
speedMultiplierfloatThe game speed multiplier, which represents how fast things should happen, which is usually determined by Speed
CanActionInterrupt(Action)
Determines whether the given action can interrupt this action.
If this method returns true, it is usually followed by a call to Interrupt(CompletionType). To call this method effectively, use ActionInterruptAction(Action, Action, CompletionType, bool).
This method returns false by default, and MultiAction returns true only if the main action has not yet started.
public override bool CanActionInterrupt(Action action)
Parameters
actionActionThe action trying to interrupt this action.
Returns
- bool
Whether the action can interrupt this action.
GetProgress()
Optionally returns the progress that this action's execution currently exhibits, in a range between 0 and 1. The returned progress will be displayed below the action icon in the top left as a green bar that is expected to fill up slowly as progress is made. Returning an empty value causes no progress bar to be displayed, and is also the default behavior.
public override float? GetProgress()
Returns
- float?
This action's progress.
PreInitialize()
This method is called in Initialize() before CreateFirstActions() is called. By default, it does nothing.
protected override void PreInitialize()