Exemplo n.º 1
0
    void Update()
    {
        if (gameState != GameState.Play)
        {
            elapsedTimeBeforeEndScene += Time.deltaTime;
            if (elapsedTimeBeforeEndScene >= endSceneLoadDelay)
            {
                float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay;
                endGameFadeCanvasGroup.alpha = timeRatio;

                float volumeRatio = Mathf.Abs(timeRatio);
                float volume      = Mathf.Clamp(1 - volumeRatio, 0, 1);
                AudioUtility.SetMasterVolume(volume);

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

            if (m_TimeManager.IsFinite && m_TimeManager.IsOver)
            {
                EndGame(false);
            }
        }
    }
Exemplo n.º 2
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);
            }

            // // Test if player died
            // if (m_Players[0].isDead)
            //     EndGame(false);
        }
    }
Exemplo n.º 3
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)
            {
                Analytics.CustomEvent("Complete Time", new Vector3(0, Time.timeSinceLevelLoad, 0));
                SceneManager.LoadScene(m_SceneToLoad);
                gameIsEnding = false;
            }
        }
        else
        {
            if (m_ObjectiveManager.AreAllObjectivesCompleted())
            {
                EndGame(true);
            }

            // Test if player died
            if (m_Player.isDead)
            {
                EndGame(false);
            }
        }
    }
Exemplo n.º 4
0
        public void OnTriggerEnter(Collider collision)
        {
            if (collision.gameObject.tag == "finish" && !isFinish && m_ObjectiveManager.AreAllObjectivesCompleted())
            {
                isFinish = true;
                isWinner = true;
                Debug.Log("isFinish True");
            }

            if (collision.gameObject.tag == "stone")
            {
                isStone = true;
                Debug.Log("isStone " + isStone);
            }
            else
            {
                isStone = false;
            }
        }
Exemplo n.º 5
0
    void Update()
    {
        //Asigna las monedas al texto
        coinsTextinMenu.text = karts[0].temporalCoins.ToString();

        //Se evalua los estados de win y loose
        if (gameState != GameState.Play)
        {
            elapsedTimeBeforeEndScene += Time.deltaTime;

            //Se espera al delay definido
            if (elapsedTimeBeforeEndScene >= endSceneLoadDelay)
            {
                float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay;
                endGameFadeCanvasGroup.alpha = timeRatio;

                float volumeRatio = Mathf.Abs(timeRatio);
                float volume      = Mathf.Clamp(1 - volumeRatio, 0, 1);
                AudioUtility.SetMasterVolume(volume);

                ////See if it's time to load the end scene (after the delay)
                if (Time.time >= m_TimeLoadEndGameScene)
                {
                    //Activa el menu de gameOver
                    gameOverMenu.gameObject.SetActive(true);
                }
            }
        }
        else
        {
            if (m_ObjectiveManager.AreAllObjectivesCompleted())
            {
                EndGame(true);
            }

            if (m_TimeManager.IsFinite && m_TimeManager.IsOver)
            {
                EndGame(false);
            }
        }
    }
Exemplo n.º 6
0
    void Update()
    {
        if (playerKart)
        {
            if (playerKart.Input.TurnInput > 0.5f)
            {
                WheelSteering.rectTransform.rotation = Quaternion.Slerp(WheelSteering.rectTransform.rotation, new Quaternion(0, 0, -1f, 1), Time.deltaTime * 1.5f);
            }
            else if (playerKart.Input.TurnInput < -0.5f)
            {
                WheelSteering.rectTransform.rotation = Quaternion.Slerp(WheelSteering.rectTransform.rotation, new Quaternion(0, 0, 1f, 1), Time.deltaTime * 1.5f);
            }
            else
            {
                WheelSteering.rectTransform.rotation = Quaternion.Slerp(WheelSteering.rectTransform.rotation, new Quaternion(0, 0, 0, 1), Time.deltaTime * 5f);
            }
        }
        if (gameState != GameState.Play)
        {
            elapsedTimeBeforeEndScene += Time.deltaTime;
            if (elapsedTimeBeforeEndScene >= endSceneLoadDelay)
            {
                float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay;
                endGameFadeCanvasGroup.alpha = timeRatio;

                float volumeRatio = Mathf.Abs(timeRatio);
                float volume      = Mathf.Clamp(1 - volumeRatio, 0, 1);
                AudioUtility.SetMasterVolume(volume);

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

                if (m_TimeManager.IsFinite && m_TimeManager.IsOver)
                {
                    EndGame(false);
                }
            }
            else
            {
                if (m_ObjectiveManager.AreAllObjectivesCompleted())
                {
                    Photon.Pun.PhotonNetwork.Disconnect();
                    SceneManager.LoadScene("Main Menu");
                }
            }
        }
    }