Пример #1
0
 public void Stop()
 {
     Debug.Log(GameTimers.TIMER + id + " Stoped!");
     OnUpdate?.Invoke(0);
     isComplete = true;
     GameTimers.RemoveTimer(id);
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
        public long GetTimeLeft()
        {
            var time = endTime - GameTimers.GetNowTimestampSeconds();

            return(time < 0 ? 0 : time);
        }