Beispiel #1
0
    public void ToNextLevel()
    {
        int       currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        ScoreKeep sk = FindObjectOfType <ScoreKeep>();

        sk.SetMoney(300);
        sk.lastLvl = currentSceneIndex + 1;
        Instantiate(Restarter);
    }
Beispiel #2
0
    public void RestartLevel()
    {
        int       currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        ScoreKeep sk = FindObjectOfType <ScoreKeep>();

        sk.SetPlayerHP(HpAtLevel);
        sk.SetScore(ScoreAtLevel);
        sk.SetMoney(MoneyAtLevel);
        sk.lastLvl = currentSceneIndex;
        Instantiate(Restarter);
    }
Beispiel #3
0
 private void Update()
 {
     if (FindObjectsOfType <ScoreKeep>().Length > 0)
     {
         sk = FindObjectOfType <ScoreKeep>();
         sk.SetMoney(Money);
         sk.SetScore(Score);
         sk.SetPlayerHP(playerHP);
         Destroy(this.gameObject);
     }
     if (FindObjectsOfType <FinalCanvas>().Length > 0)
     {
         FinalCanvas fc = FindObjectOfType <FinalCanvas>();
         fc.Score.GetComponent <TextMeshProUGUI>().text = "" + Score;
         Destroy(this.gameObject);
     }
 }