Class PickUpOrSpawnBehavior
An action behavior that causes an object to be spawned in a PersonLike's hand, or picked up from a location that it is occupying. Note that a previous item is always discarded using the DiscardHeldItemAction action.
public class PickUpOrSpawnBehavior : ActionBehavior
- Inheritance
-
PickUpOrSpawnBehavior
- Derived
- Inherited Members
- Extension Methods
Constructors
PickUpOrSpawnBehavior(BehaviorAction, Func<FurnitureType>, Func<FurnitureType, int[]>, Func<Furniture, bool>, bool)
Creates a new pick up or spawn behavior with the given settings.
public PickUpOrSpawnBehavior(BehaviorAction action, Func<FurnitureType> itemToSpawn, Func<FurnitureType, int[]> colorsToSpawn = null, Func<Furniture, bool> isValid = null, bool pickUpExisting = false)
Parameters
actionBehaviorActionThe action.
itemToSpawnFunc<FurnitureType>The item to spawn, or pick up.
colorsToSpawnFunc<FurnitureType, int[]>The colors to spawn.
isValidFunc<Furniture, bool>Whether the item that we're trying to pick up is valid. If this is null, the item is checked against the
itemToSpawn.pickUpExistingbool
Exceptions
- ArgumentNullException
Thrown if the
itemToSpawnis null.
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
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
completionCompletionTypeThe underlying action's completion type
Returns
- Action
The action that should be executed next, or null