Update(ref TimerState, DiscreteTime)
Advances a timer by a time step and applies its wrap mode.
Read time 1 minuteLast updated 4 hours ago
Definition
- Type: Method
- Namespace: Unity.Animations
- Assembly: UnityEngine.AnimationCoreModule
Update(TimerState, DiscreteTime)
public static void Update(this ref TimerState timerState, DiscreteTime deltaTime)
Parameters
The timer to update. The method changes this timer.
The time step to advance the timer by, before the method multiplies it by TimerState.TimeScale.
Remarks
The method first stores the current TimerState.Time, TimerState.LoopCount, and TimerState.PlayState as the previous values. TimerState.PlayState then takes the value of TimerState.NextPlayState.
If the timer isn't playing, TimerState.DeltaTime is zero and the time doesn't change. Otherwise, TimerState.DeltaTime is multiplied by TimerState.TimeScale, and the method advances TimerState.Time according to TimerState.WrapMode:
deltaTime-
WrapMode.Loop wraps the time around the range and updates the loop count.
-
WrapMode.PingPong reverses the direction at each end of the range and updates the loop count.
-
WrapMode.Once moves the time to the opposite end of the range when it passes the end, and stops the timer on the next update.
-
WrapMode.ClampForever clamps the time to the range.
-
WrapMode.Default advances the time without limit.