LongHoldInteractable
A class in Root.Township, the global namespace.
Interactable that tells a short grab from a long hold. Used by CommunalStorage; the local client times the grip and tells the server which one happened.
- Listed in Global namespace: I to L
- Inherits or implements
Interactable - Nested types
InteractArguments - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
LongHoldInteractable() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
Action<Interactor> onLongHeld | Called with the hand when a long hold completes, on the client and again on the server. |
Action<Interactor> onShortHeld | Called with the hand when the grab ends as a short hold, on the client and again on the server. |
3 private and internal fields
| Member | What it is |
|---|---|
private float distanceTriggerSquared | Squared distance the hand may move from where it grabbed before the hold ends as a short hold. |
private float pickupDuration | Seconds the grip must last to count as a long hold. Defaults to 0.5. |
private MethodSyncStruct<LongHoldInteractable.InteractArguments> syncInteract | Method sync on SpawnPouch that sends hold results to the server. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Creates the syncInteract method sync. |
override void Interact(Interactor interactor) | On the local client, starts GripTimer or GripTimerPouch depending on whether hard grab is already held. |
5 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator GripTimer(Interactor interactor, BooleanInput hardInteractProxy) (iterator) | Client coroutine for a grab started with hard grab held: long hold if kept still for pickupDuration, short if released or moved. |
private IEnumerator GripTimerPouch(Interactor interactor, BooleanInput hardInteractProxy) (iterator) | Client coroutine for a grab started without hard grab: counts down only while hard grab is pressed, then reports long or short. |
private void LongHeld(Interactor interactor) | Fires onLongHeld and, on a client, sends it to the server. |
private void ShortHeld(Interactor interactor) | Fires onShortHeld and, on a client, sends it to the server. |
private void SyncInteract(IPlayer player, Stream stream, LongHoldInteractable.InteractArguments arguments) | Method sync carrying the hand and long or short hold. The server fires the matching callback if the hand belongs to the sender. |
Used in
Members of other types that take, return or hold a LongHoldInteractable: