Skip to main content

PullCord

A class in Root.Township, the global namespace.

Fires an event when a held pickup is pulled far enough from an origin point, like a cord or rip handle. Runs wherever the pickup is held.

  • Listed in Global namespace: P
  • Inherits or implements MonoBehaviour
  • Attributes RequireComponent

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private bool isPulledTrue while the pickup is past the pull distance, so the event only fires once per pull.
private Transform originPoint the pull distance is measured from.
private Pickup pickupPickup on this object that is pulled.
private float pullDistanceSquaredSquared distance from origin that counts as pulled.
private AltaEvent pulledEvent fired when the cord is pulled.
private IUnityUpdateMethod updateHandle for the registered late-update check.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Hooks the pickup's interaction start and end to start and stop checking.
private void EndCheck(Interactable arg1, Interactor arg2)Stops the distance check when the pickup is let go.
private void StartCheck(Interactable arg1, Interactor arg2)Starts a late-update distance check when the pickup is grabbed.
private void UpdatePull()Fires pulled the first time the pickup passes the pull distance; resets once it comes back.