A class in Root.Township, the global namespace.
Holds one pickup in place at an interaction point, frozen and parented to this entity, and syncs which pickup it holds. Used by DecraftingDeck. The server decides what is held.
Constructors
| Member | What it is |
|---|
PickupHolder() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private Transform interactionPoint | Transform the held pickup is grabbed to. |
private Coroutine moveToPosition | Running MoveToPosition coroutine, if any. |
private float moveToPositionDuration | Seconds the held pickup takes to ease into place. Defaults to 0.5. |
private MethodSyncStruct<uint> syncHeldPickup | Method sync on SyncA for the held pickup's ID. |
Properties
| Member | What it is |
|---|
Pickup HeldPickup { get; private set; } | The pickup currently held, or null. |
Events
| Member | What it is |
|---|
event PickupHolderFilter HoldFilter | Lets listeners refuse a pickup before it is held by setting the ref valid flag to false. |
event OnHeld OnHeld | Raised after HoldPickup with the pickup. |
Methods
| Member | What it is |
|---|
void HoldPickup(Pickup pickup) | Holds the pickup and fires OnHeld. On a client it also sends the ID to the server, but the server ignores incoming syncs. |
override void Initialize() | Creates the syncHeldPickup method sync. |
override void OnConnected(Player player) | Sends the held pickup's ID (or 0) to a joining player. |
void ReleasePickup() | Unfreezes and unparents the held pickup; the server restores its save mode and syncs the release. |
4 private and internal methods
| Member | What it is |
|---|
private void InternalHoldPickup(Pickup pickup) | Releases the old pickup, checks HoldFilter, then freezes and parents the new one; the server saves it as a child and syncs it. |
private IEnumerator MoveToPosition() (iterator) | Client coroutine that eases the held pickup into its grab pose over moveToPositionDuration, with colliders off. |
private void SetCollidersEnabled(bool isEnabled) | Turns all of the held pickup's colliders on or off. |
private void SyncHeldPickup(IPlayer player, Stream stream, uint heldIdentifier) | Method sync with the held entity ID. Clients wait for that entity to spawn and hold it, or release on 0. |
Used in
Members of other types that take, return or hold a PickupHolder: