public void Stop() { Debug.Log(GameTimers.TIMER + id + " Stoped!"); OnUpdate?.Invoke(0); isComplete = true; GameTimers.RemoveTimer(id); }
private void Update() { _preTime = timeLeft; timeLeft = GetTimeLeft(); if (_preTime != timeLeft) { OnUpdate?.Invoke(timeLeft); } if (timeLeft <= 0) { Debug.Log(GameTimers.TIMER + id + " Completed!"); isComplete = true; GameTimers.RemoveTimer(id); OnComplete?.Invoke(this); } }
public long GetTimeLeft() { var time = endTime - GameTimers.GetNowTimestampSeconds(); return(time < 0 ? 0 : time); }