private void Update()
        {
            if (timerStarted)
            {
                if (!gameData.gameIsPaused)
                {
                    gameData.dayCountdownSeconds += Time.deltaTime * gameData.gameSpeed;

                    float nightTime = Mathf.Floor(gameData.dayCountdownSeconds);
                    if (nightTime == gameData.daySpeedInSeconds * 0.5f && !hasTriggeredNightStart)
                    {
                        hasTriggeredNightStart = true;
                        OnDayComplete?.Invoke();
                    }

                    if (gameData.dayCountdownSeconds >= gameData.daySpeedInSeconds)
                    {
                        gameData.dayCountdownSeconds = 0;

                        hasTriggeredNightStart = false;

                        OnDayStarted?.Invoke();
                    }
                }
            }
        }
Exemplo n.º 2
0
 void DayTicks()
 {
     OnDayComplete?.Invoke();
     DayCounter += 1;
     GameManager.instance.UI.UpdateDayTimeUI();
 }