Skip to main content

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.

Constructors​

MemberWhat it is
HandStore(Controller sourceController)Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

1 private and internal field
MemberWhat it is
private readonly Controller sourceControllerThe hand controller this store wraps.

Properties​

MemberWhat 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​

MemberWhat 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).
1 private and internal method
MemberWhat it is
private bool Pop()Force-stops the hand's interaction (as server when on the server) and returns whether it is now empty.