Table of Contents

Class PickUpOrSpawnBehavior

Namespace
TinyLife.Actions.Behaviors
Assembly
Tiny Life.dll

An action behavior that causes an object to be spawned in a Person'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 Action

The 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

IEnumerable<Action>

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 CompletionType

The underlying action's completion type

Returns

Action

The action that should be executed next, or null