A class in Root.Township, the global namespace.
Animates a value from 0 to 1 over a set time and passes it to a FloatEvent each frame, for driving UI or effects from inspector events.
Constructors
| Member | What it is |
|---|
AnimateProgress() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private float duration | Seconds the 0 to 1 animation takes. |
private float progress | Current progress, 0 to 1. |
private FloatEvent progressUpdate | Event invoked with the progress every step. |
private bool resetsOnLoop | If true, calling Animate after it finished starts again from 0. |
private IUnityUpdateMethod update | Handle for the registered update method. |
Methods
| Member | What it is |
|---|
void Animate() | Starts (or restarts) the per-frame update; resets to 0 first if resetsOnLoop is set and it had finished. |
void Reset() | Sets progress back to 0 and fires the event with 0. |
2 private and internal methods
| Member | What it is |
|---|
private void OnDestroy() | Deregisters the update. |
private void UpdateProgress() | Per-frame step: adds delta time over duration, clamps at 1 and stops there, then fires the event. |