Esempio n. 1
0
    public void CheckGameOver()
    {
        if (gameState == state.RUNNING)
        {
            if (happinessPercentage < gameOverLimit)
            {
                gameOverCountdown -= 1;
                hud.ShowGameOverCountdown(gameOverCountdown);
                Debug.Log(gameOverCountdown + " to gameover");
                if (gameOverCountdown > 0)
                {
                    return;
                }

                Broadcast("OnGameStopped", SendMessageOptions.DontRequireReceiver);
                gameState = state.GAMEOVER;
                hud.HideGameOverCountdown();
                hud.ShowGameOverPanel();
                OffscreenIndicator[] oi = FindObjectsOfType <OffscreenIndicator>();
                foreach (OffscreenIndicator o in oi)
                {
                    o.indicator.gameObject.SetActive(false);
                }
                GameStatistics.AddTotalNumberOfVisitors(visitorManager.allVisitors.Count);
            }
            else
            {
                gameOverCountdown = gameOverCountdownStore;
                hud.HideGameOverCountdown();
            }
        }
    }