Example #1
0
    /*public void CheckForEnemiesLeft()
     * {
     *      if (GameObject.FindWithTag("Enemy") == null)
     *      {
     *              //Do any finishing up
     *              SceneManager.LoadScene("Game");
     *      }
     * }*/

    public void GameOver()
    {
        gameOver = true;
        StopAllCoroutine();
        _coinController.StopCoinCoroutine();
        pauseButton.SetActive(false);
        gameOverPanel.SetActive(true);
        gamePausePanel.SetActive(false);
        PlayerPrefs.SetInt("BulletCount", 1);

        //int bestScore = PlayerPrefs.GetInt("BestScore");

        /*if (score > bestScore)
         * {
         *      bestScore = score;
         *      //if (GameMode != "ChildMode") PlayerPrefs.SetInt("BestScore", score);
         * }*/

        if (PlayerPrefs.GetInt("BestScore") < score)
        {
            PlayerPrefs.SetInt("BestScore", score);
        }

        //highestScoreText.text = "SCORE: " + score;


        //scoreText.text = "";
        yourScoreText.text    = "Your Score - " + score;
        highestScoreText.text = "Best score - " + PlayerPrefs.GetInt("BestScore");
    }