Scrubber
A class in Root.Township, Alta.Mechanisms.
A grabbable handle that slides along a Path in fixed steps, like a slider. It reports the step the hand moves it to and eases the handle there. Runs locally; it is not networked itself.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour - Documented in Other systems
Constructors
| Member | What it is |
|---|---|
Scrubber() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private Interactable baseInteractable | The handle players grab. |
private Transform baseTransform | The handle's transform, moved along the path. |
private float currentProgress | The handle's current progress along the path. |
private int currentStep | The current step. |
private Coroutine grabCoroutine | The running Grabbing coroutine. |
private float movementSpeed | How fast the handle moves, in path progress per second (default 0.1). |
private Path path | The path the handle moves along. |
private IUnityUpdateMethod positionUpdate | The registered UpdateBasePosition update while moving. |
private int steps | Backing field for Steps. |
private float targetProgress | Progress of the current step. |
private IntEvent updatedStep | Event raised with the new step when the hand moves the handle to it. |
Properties
| Member | What it is |
|---|---|
int Steps { get; set; } | Number of steps along the path. Setting it moves the handle at once to the current step's new place. |
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private void EndCoroutine() | Stops the grab coroutine if one is running. |
private void EndGrab(Interactable interactable, Interactor interactor) | Stops tracking the hand when the grab ends. |
private IEnumerator Grabbing(Interactor interactor) (iterator) | Coroutine that, while held, snaps the hand's progress along the path to a step and raises updatedStep when it changes. |
private void Start() | Hooks the handle's grab events and puts the handle at the start of the path. |
private void StartGrab(Interactable interactable, Interactor interactor) | Starts tracking the hand that grabbed the handle. |
private void UpdateBasePosition() | Per-frame update that eases the handle towards the target step, then stops. |
Used in
Members of other types that take, return or hold a Scrubber: