chip-gameV3/Assets/Scripts/HoldTimer.cs
sega b60ca37793 Рефакторинг MenuState
Сокращение и реорганизация кода;
Больше SRP
2026-07-16 11:33:31 +03:00

20 lines
425 B
C#

using UnityEngine;
public class HoldTimer
{
private float targetTime;
private float currentTime;
public HoldTimer(float target) => targetTime = target;
public bool Update(bool isHolding)
{
currentTime = isHolding
? Mathf.Min(currentTime + Time.deltaTime, targetTime)
: 0;
return currentTime >= targetTime;
}
public void Reset() => currentTime = 0;
}