Skip to main content

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.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private Interactable baseInteractableThe handle players grab.
private Transform baseTransformThe handle's transform, moved along the path.
private float currentProgressThe handle's current progress along the path.
private int currentStepThe current step.
private Coroutine grabCoroutineThe running Grabbing coroutine.
private float movementSpeedHow fast the handle moves, in path progress per second (default 0.1).
private Path pathThe path the handle moves along.
private IUnityUpdateMethod positionUpdateThe registered UpdateBasePosition update while moving.
private int stepsBacking field for Steps.
private float targetProgressProgress of the current step.
private IntEvent updatedStepEvent raised with the new step when the hand moves the handle to it.

Properties​

MemberWhat 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
MemberWhat 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: