Beispiel #1
0
 void Start()
 {
     if (FindObjectOfType <ScoreKeep>() != null)
     {
         ScoreKeep sk = FindObjectOfType <ScoreKeep>();
         ScoreAtLevel = sk.GetScore();
         MoneyAtLevel = sk.GetMoney();
         HpAtLevel    = sk.GetPlayerHP();
     }
 }
Beispiel #2
0
 // Start is called before the first frame update
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     gc       = FindObjectOfType <GameCanvas>();
     sk       = FindObjectOfType <ScoreKeep>();
     Money    = sk.GetMoney();
     Score    = sk.GetScore();
     playerHP = sk.GetPlayerHP();
     loadMe   = sk.lastLvl;
     Destroy(gc.gameObject);
     Destroy(sk.gameObject);
     gc = null;
     sk = null;
     SceneManager.LoadScene(loadMe);
 }
    // Update is called once per frame
    void Update()
    {
        if (!player && end)
        {
            gameOverScreen.SetActive(true);

            int currentScore = ScoreKeep.GetScore();

            if (currentHighScore < currentScore)
            {
                SetNewHighScore(currentScore);
            }

            string highestScore = currentHighScore.ToString();

            DisplayHighScore(highestScore);
            end = false;
        }
    }