private IEnumerator NextTime()
        {
            while (_timerIsOn)
            {
                if (_isPaused)
                {
                    continue;
                }

                yield return(new WaitForSeconds(1 * Time.timeScale));

                _timer += 1;

                if ((int)_timer % _realSecondsForOneMonth == 0)
                {
                    OnNewMonth?.Invoke(GetGameTime());
                }

                if ((int)_timer % (_realSecondsForOneMonth * 12) == 0)
                {
                    OnNewYear?.Invoke(GetGameTime());
                }

                //
            }
        }
 public void StartTimer()
 {
     _timer     = 0;
     _timerIsOn = true;
     OnTimerStarted?.Invoke(GetGameTime());
     OnNewMonth?.Invoke(GetGameTime());
     OnNewYear?.Invoke(GetGameTime());
     _coroutine = StartCoroutine(NextTime());
 }
Exemplo n.º 3
0
 protected virtual void OnNewYearPassed(OnNewYear e)
 {
 }
Exemplo n.º 4
0
 protected void OnYearPassed(OnNewYear e)
 {
     ResourcesManager.Instance.UpdateBudget();
 }