Ejemplo n.º 1
0
    void GameTimer()
    {
        //Counting down the timer
        if (gameTime > 0)
        {
            gameTime -= Time.deltaTime;
        }
        //Timer runs out. End game
        else
        {
            targetManager.startSpawning = false;

            //Checking if the player has set a new high score
            if (highscoreManager.CheckHighScores(score))
            {
                sceneLoader.LoadNewHighScoreScene();
            }
            //If not, load game over scene
            else
            {
                sceneLoader.LoadGameOverScene();
            }
        }

        //Displaying the time left
        timeText.text = "Time Left: \n" + gameTime.ToString("f0");
    }