A class in Root.Township, the global namespace.
Animates a 0 to 1 progress value over time when switched on or off and reports it through a float event.
Constructors
| Member | What it is |
|---|
EnableLerp() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected Coroutine lerpAnimation | The running animation coroutine. |
5 private and internal fields
| Member | What it is |
|---|
private float animationDuration | Seconds for a full 0 to 1 change. |
private float disabledValue | Progress at which the off animation stops before snapping to 0. |
private float enabledValue | Progress at which the on animation stops before snapping to 1. |
private float progress | Current progress value. |
private FloatEvent progressUpdate | Event that receives the progress. |
Properties
| Member | What it is |
|---|
bool IsEnabled { get; private set; } | Current target state. |
Methods
| Member | What it is |
|---|
void SetEnabled(bool isEnabled) | Changes the state and restarts the animation if it differs. |
protected virtual void StartAnimation() | Stops any running animation and starts a new one. |
1 private and internal method
| Member | What it is |
|---|
private IEnumerator Animation() (iterator) | Coroutine that moves progress up to enabledValue or down to disabledValue, invoking the event each frame, then snaps to 1 or 0. |