chip-gameV3/Assets/Scripts/HoldTimer.cs
sega 89a8f4d79b Доработка перехода меню<->промо
- При переходах "из меню" и "в меню" делать фейд основной музыки
- Добавить переход по таймеру в промо
- Пробросить установку громкости промо из настроек
- Выпилить устаревший PromoState
2026-08-19 12:43:21 +03:00

23 lines
492 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;
var result = currentTime >= targetTime;
if (result == true) Reset();
return result;
}
public void Reset() => currentTime = 0;
}