Example #1
0
    public void Death()
    {
        if (!IsDead)
        {
            GameOverPanel.SetActive(true);
            //اگز کاربر رکوردش را زده بود رکود جدید ثبت شود
            if (PlayerPrefs.GetInt("BestScore", 0) < GetComponent <UIManager>().Score)
            {
                PlayerPrefs.SetInt("BestScore", GetComponent <UIManager>().Score);
                NewRecordLable.SetActive(true);
            }
            BestLable.GetComponent <Text>().text = "Best: " + PlayerPrefs.GetInt("BestScore", 0);


            //از بین بردن حرکت بازیکن
            player.GetComponent <Animator>().SetInteger("State", 2);
            player.GetComponent <Animator>().speed          = 1;
            player.GetComponent <Rigidbody2D>().velocity    = new Vector2(0f, 0f);
            player.GetComponent <UIManager>().enabled       = false;
            player.GetComponent <PlayerControler>().enabled = false;


            IsDead = true;
        }
    }
Example #2
0
 void Death()
 {
     GameOverPanel.SetActive(true);
     //اگز کاربر رکوردش را زده بود رکود جدید ثبت شود
     if (PlayerPrefs.GetInt("BestScore", 0) < GetComponent <UIManager>().Score)
     {
         PlayerPrefs.SetInt("BestScore", GetComponent <UIManager>().Score);
         NewRecordLable.SetActive(true);
     }
     BestLable.GetComponent <Text>().text            = "Best: " + PlayerPrefs.GetInt("BestScore", 0);
     player.GetComponent <Rigidbody2D>().simulated   = false;
     player.GetComponent <PlayerControler>().enabled = false;
 }