Ejemplo n.º 1
0
    void Update()
    {
        if (gameIsEnding)
        {
            float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay;
            endGameFadeCanvasGroup.alpha = timeRatio;

            AudioUtility.SetMasterVolume(1 - timeRatio);

            // See if it's time to load the end scene (after the delay)
            if (Time.time >= m_TimeLoadEndGameScene)
            {
                SceneManager.LoadScene(m_SceneToLoad);
                gameIsEnding = false;
            }
        }
        else
        {
            if (m_ObjectiveManager.AreAllObjectivesCompleted())
            {
                EndGame(true);

                TelemetryLogger.LogVictory("Objectives", m_Player.transform.position, m_ObjectiveManager.ObjectivesCompleted);
            }

            // Test if player died
            if (m_Player.isDead)
            {
                EndGame(false);
            }
        }
    }