Skip to main content

LocalPlayerInteractionEvents

A class in Root.Township, the global namespace.

Fires Unity events when the local player starts or stops using an Interactable. Other players' interactions are ignored. Client.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private InteractableEvent firstInteractionStartedEvent fired when the local player is the first to grab it.
private Interactable interactableThe interactable being watched.
private InteractableEvent interactionEndedEvent fired whenever the local player lets go.
private InteractableEvent interactionStartedEvent fired whenever the local player grabs it.
private InteractableEvent lastInteractionEndedEvent fired when the local player lets go and no one else holds it.

Methods​

3 private and internal methods
MemberWhat it is
private void Awake()Subscribes to the interactable's start and end events.
private void InteractionEnded(Interactable interactable, Interactor interactor)For the local player, fires interactionEnded, and lastInteractionEnded if nobody is still interacting.
private void InteractionStarted(Interactable interactable, Interactor interactor)For the local player, fires interactionStarted, and firstInteractionStarted if it is the only interactor.