HandStore
A class in Root.Township, Alta.Character.
Inventory store wrapping one hand's Interactor, so Inventory can put items in and take them out of a hand. Grabs and releases are forced.
- Listed in Players and characters
- Inherits or implements
IInventoryStore<Interactor>
Constructors
| Member | What it is |
|---|---|
HandStore(Controller sourceController) | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
1 private and internal field
| Member | What it is |
|---|---|
private readonly Controller sourceController | The hand controller this store wraps. |
Properties
| Member | What it is |
|---|---|
int Count { get; } | 0 if the hand is empty, the pouch's stored count if it holds a pouch, otherwise 1. |
Interactor Source { get; } | The hand's Interactor. |
Methods
| Member | What it is |
|---|---|
bool CanAdd(Pickup pickup) | True if the pickup isn't null and the hand is empty. |
Pickup Peek() | The held pickup. Throws InvalidOperationException if the hand is empty. |
bool Search(Func<Pickup, bool> predicate) | Tests the held pickup with the predicate. Unlike DockStore, doesn't look inside pouches. |
bool TryPeek(out Pickup pickup) | Gets the held pickup and returns whether the hand holds one. |
bool TryPop(out Pickup pickup) | Releases the held pickup, optionally only if it matches the predicate, and returns it. |
bool TryPop(out Pickup pickup, Func<Pickup, bool> predicate) | Releases the held pickup, optionally only if it matches the predicate, and returns it. |
bool TryPush(Pickup pickup) | Forces the hand to grab the pickup (as server when on the server). |