Exemplo n.º 1
0
    void Start()
    {
        playerIsDead = false;
        brickBreak   = new int[8];

        uiButtons.OnStart();

        if (!PlayerPrefs.HasKey("PlayerScore1"))
        {
            PlayerPrefs.SetInt("PlayerScore1", 0);
            PlayerPrefs.SetInt("PlayerScore2", 0);
            PlayerPrefs.SetInt("PlayerScore3", 0);
            PlayerPrefs.SetInt("PlayerScore4", 0);
            PlayerPrefs.SetInt("PlayerScore5", 0);

            PlayerPrefs.SetString("PlayerDate1", DateTime.Today.ToShortDateString());
            PlayerPrefs.SetString("PlayerDate2", DateTime.Today.ToShortDateString());
            PlayerPrefs.SetString("PlayerDate3", DateTime.Today.ToShortDateString());
            PlayerPrefs.SetString("PlayerDate4", DateTime.Today.ToShortDateString());
            PlayerPrefs.SetString("PlayerDate5", DateTime.Today.ToShortDateString());

            PlayerPrefs.SetInt("BricksDestroyed0", 0);
            PlayerPrefs.SetInt("BricksDestroyed1", 0);
            PlayerPrefs.SetInt("BricksDestroyed2", 0);
            PlayerPrefs.SetInt("BricksDestroyed3", 0);
            PlayerPrefs.SetInt("BricksDestroyed4", 0);
            PlayerPrefs.SetInt("BricksDestroyed5", 0);
            PlayerPrefs.SetInt("BricksDestroyed6", 0);
            PlayerPrefs.SetInt("BricksDestroyed7", 0);

            PlayerPrefs.SetFloat("PlayerDeathLevel", 5);
        }
        deathBar.transform.position = new Vector2(0, PlayerPrefs.GetFloat("PlayerDeathLevel"));

        gravityOriginal    = new Vector3(0, -12.5f, 0);
        Physics2D.gravity  = gravityOriginal;
        highScoreText.text = "HIGH SCORE: " + PlayerPrefs.GetInt("PlayerScore1").ToString("00000000");

        Time.timeScale = 1;
        //gameOverScreen.enabled = false;
        UpdateBallColor();
    }