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.
Constructors
| Member | What it is |
|---|
PullCord() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private bool isPulled | True while the pickup is past the pull distance, so the event only fires once per pull. |
private Transform origin | Point the pull distance is measured from. |
private Pickup pickup | Pickup on this object that is pulled. |
private float pullDistanceSquared | Squared distance from origin that counts as pulled. |
private AltaEvent pulled | Event fired when the cord is pulled. |
private IUnityUpdateMethod update | Handle for the registered late-update check. |
Methods
4 private and internal methods
| Member | What 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. |