Ejemplo n.º 1
0
    public void GameOver()
    {
        StartCoroutine("DestroyAllRemainingProjectiles");
        StopMusic(3f);

        projesKilled     = 0;
        totalProjsKilled = 0;

        gameoverUI.scoreWord.text = Language.TranslationDictionary[PlayerPrefs.GetString(MainMenuScript.GameLanguage)]
                                    [SceneManager.GetActiveScene().buildIndex]
                                    [Language.PlayGameOverScoreWord];

        if (player.score > player.highscore)
        {
            player.highscore          = player.score;
            gameoverUI.scoreWord.text =
                Language.TranslationDictionary[PlayerPrefs.GetString(MainMenuScript.GameLanguage)]
                [SceneManager.GetActiveScene().buildIndex]
                [Language.PlayGameOverNewHighscoreWord];
        }

        if (player.wave > player.maxWave)
        {
            player.maxWave = player.wave;
        }

        RemoveAllBonuses();
        changeWaveUI.GameOverChanges();

        gameoverUI.gameObject.SetActive(true);
        gameoverUI.scoreText.text = player.score.ToString();
        gameoverUI.ShowGameOverMenu();

        print("GAME OVER");
        changingLevel = true;
    }