fix: ticker behaviour working unexpectedly on instances where time increment is bigger than the period

This commit is contained in:
Syntriax 2025-04-12 17:49:30 +03:00
parent 80202d4a07
commit bfbcfdce4f

View File

@ -20,12 +20,12 @@ public class TickerBehaviour : StopwatchBehaviour, ITicker
{ {
base.OnUpdate(); base.OnUpdate();
if (Time < nextTick) while (Time > nextTick)
return; {
nextTick += Period;
nextTick += Period; TickCounter++;
TickCounter++; OnTick?.Invoke(this);
OnTick?.Invoke(this); }
} }
protected override void OnFinalize() protected override void OnFinalize()