Class GetAndSitDownBehavior
A get-and-sit-down behavior is an ActionBehavior where a person gets an action object that can be picked up (like a plate of food) and interacts with it on a chair or at a standing desk. This behavior considers a multitude of possible circumstances for the action, including the item being on a counter, on the ground, already on a valid table, in the person's hand, and more. Note that GetInteractingItemForAction<T>(ActionInfo, params FurnitureType[]) should be used to ensure that the correct interaction item is returned in every circumstance.
public class GetAndSitDownBehavior : ActionBehavior
- Inheritance
-
GetAndSitDownBehavior
- Inherited Members
- Extension Methods
Constructors
GetAndSitDownBehavior(Action, bool, bool, params FurnitureType[])
Creates a new get-and-sit-down behavior with the given settings
public GetAndSitDownBehavior(Action action, bool forceTable, bool allowStandingDesk, params FurnitureType[] workItems)
Parameters
action
ActionThe action that uses this behavior
forceTable
boolA property that determines whether this action requires a table to be executed. If this value is false, the person is able to sit down on a chair or a bench without a table if there is none present.
allowStandingDesk
boolA property that determines whether this action can be executed at a StandingDesk
workItems
FurnitureType[]An array of FurnitureType instances that represents all ietms which can be gotten and sat down with. This array is used to check the validity of a person's held item and items on tables.
Methods
CreateFirstActions()
Creates a set of actions that should be executed before the main Action starts. This method is automatically called when using BehaviorAction in CreateFirstActions().
public override IEnumerable<Action> CreateFirstActions()
Returns
GetIconObject()
Returns this action behavior's icon object. This method is automatically called when using BehaviorAction in GetIconObject(). By default, this method returns the underlying ActionInfo's GetActionObject<T>(bool).
public override MapObject GetIconObject()
Returns
- MapObject
The icon object
GetInteractingItemForAction<T>(ActionInfo, params FurnitureType[])
A helper method that returns the item instance that is currently being interacted with in this action. Since this action type is rather complex, this is the favored way over GetActionObject<T>(bool).
public static T GetInteractingItemForAction<T>(ActionInfo info, params FurnitureType[] workItems) where T : Furniture
Parameters
info
ActionInfoworkItems
FurnitureType[]
Returns
- T
The object, or null if there is none
Type Parameters
T
The type that the object is expected to be
GetInteractingItem<T>()
A helper method that returns the item instance that is currently being interacted with in this action. Since this action type is rather complex, this is the favored way over GetActionObject<T>(bool).
public T GetInteractingItem<T>() where T : Furniture
Returns
- T
The object, or null if there is none
Type Parameters
T
The type that the object is expected to be
GetNextAction(CompletionType)
Returns the action that should be executed after this action behavior's underlying Action completes. This method is automatically called when using BehaviorAction in GetNextAction(CompletionType).
public override Action GetNextAction(CompletionType completion)
Parameters
completion
CompletionTypeThe underlying action's completion type
Returns
- Action
The action that should be executed next, or null
Initialize()
Initializes this action behavior. This method is automatically called when using BehaviorAction in AndThenInitialize().
public override void Initialize()
Update(GameTime, TimeSpan, float)
Updates this action behavior every update frame. This method is automatically called when using BehaviorAction in AndThenUpdate(GameTime, TimeSpan, float).
public override void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)