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());
                }

                //
            }
        }
Exemplo n.º 2
0
    public override void OnUpdate(OnNewMonth e)
    {
        if (!HaveBudget(EWorldImpactType.BasicTownHall))
        {
            budgetComponent.SetNewImpact(EWorldImpactType.BankruptedTownHall);
        }
        else
        {
            budgetComponent.RemoveImpact(EWorldImpactType.BankruptedTownHall);
        }

        if (!budgetComponent.Working)
        {
            _happy = false;
            UpdateNPCMoods(false);
        }
        else
        {
            if (!_happy)
            {
                UpdateNPCMoods(true);
            }
            _happy = true;
        }
    }
Exemplo n.º 3
0
 protected void NewMonth(OnNewMonth e)
 {
     if (TimeManager.Instance)
     {
         string month = TextManager.GetText(((TimeManager.Instance.ActualMonth % 12) + 1) + "month");
         text.text = month + " " + (TimeManager.INITIAL_YEAR + TimeManager.Instance.ActualYear);
     }
 }
 public void StartTimer()
 {
     _timer     = 0;
     _timerIsOn = true;
     OnTimerStarted?.Invoke(GetGameTime());
     OnNewMonth?.Invoke(GetGameTime());
     OnNewYear?.Invoke(GetGameTime());
     _coroutine = StartCoroutine(NextTime());
 }
Exemplo n.º 5
0
 public virtual void OnUpdate(OnNewMonth e)
 {
     if (budgetComponent != null)
     {
         if (budgetComponent.Working)
         {
             DisplayMood(true);
         }
         else
         {
             DisplayMood(false);
         }
     }
 }
Exemplo n.º 6
0
 protected virtual void OnNewMonthPassed(OnNewMonth e)
 {
 }
Exemplo n.º 7
0
 protected void OnMonthPassed(OnNewMonth e)
 {
 }
Exemplo n.º 8
0
 public override void OnUpdate(OnNewMonth e)
 {
     base.OnUpdate(e);
     UpdateZone();
 }