Class BehaviorAction
A behavior-based action is an Action that invokes an underlying ActionBehavior in the appropriate places. This type of action can be useful for when an action uses a basic behavior, but does a more complex additional action. See BehaviorAction<T> for a generic version with some additional functionality.
public abstract class BehaviorAction : MultiAction, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderBehaviorAction
- Implements
-
IGenericDataHolder
- Derived
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
BehaviorAction(ActionInfo, Type)
protected BehaviorAction(ActionInfo info, Type behaviorType)
Parameters
infoActionInfobehaviorTypeType
BehaviorAction(ActionType, ActionInfo, Type)
protected BehaviorAction(ActionType type, ActionInfo info, Type behaviorType)
Parameters
typeActionTypeinfoActionInfobehaviorTypeType
Properties
Behavior
The underlying ActionBehavior that this action uses and invokes
public ActionBehavior Behavior { get; protected set; }
Property Value
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 always returns true, since regular actions immediately start their main part.
public override bool FullyInProgress { get; }
Property Value
- bool
Whether this action is fully in progress
InProgressTime
Represents the amount of time that this action has "properly" been in progress for. This is used by MultiAction and SocialAction and returns a time greater than Zero only once the first actions are completed or the conversation has started, respectively. By default, ElapsedTime is returned.
public override TimeSpan InProgressTime { get; }
Property Value
- TimeSpan
The amount of time that this action has properly been in progress for
Methods
AndThenInitialize()
Initializes the main action. This method is called after Handler has all completed.
protected override void AndThenInitialize()
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
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 Action.CanMultitaskResult CanMultitask(Action other)
Parameters
otherActionThe action to multi-task with
Returns
- Action.CanMultitaskResult
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
CreateLastActions()
Return a set of actions that should be executed after this action. Even if the yield statement is used, all actions will be collected into a list after the main action is finished. If no action gets returned in this function, this action fails. If the returned set only contains null items, no last actions will be executed, which is also this method's default behavior.
protected override IEnumerable<Action> CreateLastActions()
Returns
- IEnumerable<Action>
A set of actions that should run after this action
GetIconObject()
Returns the map object that is displayed in the action queue in the top left of the screen using DrawIcon(Element, GameTime, SpriteBatch). Note that this value is ignored if this action's type has a Texture. By default, the GetActionObject<T>(bool) is returned.
public override MapObject GetIconObject()
Returns
- MapObject
The icon object
GetNextAction(CompletionType)
Returns an action that should be queued up immediately after this action completes in any way, including after being interrupted using Interrupt(CompletionType). 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
completionCompletionTypeThe type that this action completed with
Returns
- Action
The follow-up action