void Start() { if (FindObjectOfType <ScoreKeep>() != null) { ScoreKeep sk = FindObjectOfType <ScoreKeep>(); ScoreAtLevel = sk.GetScore(); MoneyAtLevel = sk.GetMoney(); HpAtLevel = sk.GetPlayerHP(); } }
// Update is called once per frame void Update() { money = ScoreKeeper.GetMoney(); if (selectedTurret >= 0) { if (Input.GetMouseButtonDown(0)) { Debug.Log("Placing tower"); PlaceTurret(); } } }
// 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); }