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(Action, Func<FurnitureType>, int[], Func<Furniture, bool>)
Creates a new pick up or spawn behavior with the given settings.
public PickUpOrSpawnBehavior(Action action, Func<FurnitureType> itemToSpawn, int[] colorsToSpawn = null, Func<Furniture, bool> isValid = null)
Parameters
action
ActionThe action.
itemToSpawn
Func<FurnitureType>The item to spawn, or pick up.
colorsToSpawn
int[]The colors to spawn.
isValid
Func<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
.
Exceptions
- ArgumentNullException
Thrown if the
itemToSpawn
is 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
completion
CompletionTypeThe underlying action's completion type
Returns
- Action
The action that should be executed next, or null