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()); }
protected virtual void OnNewYearPassed(OnNewYear e) { }
protected void OnYearPassed(OnNewYear e) { ResourcesManager.Instance.UpdateBudget(); }