Skip to main content

EnableLerp

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​

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

Fields​

MemberWhat it is
protected Coroutine lerpAnimationThe running animation coroutine.
5 private and internal fields
MemberWhat it is
private float animationDurationSeconds for a full 0 to 1 change.
private float disabledValueProgress at which the off animation stops before snapping to 0.
private float enabledValueProgress at which the on animation stops before snapping to 1.
private float progressCurrent progress value.
private FloatEvent progressUpdateEvent that receives the progress.

Properties​

MemberWhat it is
bool IsEnabled { get; private set; }Current target state.

Methods​

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