void Start() { healthScript = GameObject.FindWithTag("HealthUI").GetComponent <DisplayHealth>(); livesScript = GameObject.FindWithTag("LivesUI").GetComponentInChildren <DisplayLives> (); if (PlayerPrefs.HasKey("247127CurrentPlayerHealth")) { health = PlayerPrefs.GetInt("247127CurrentPlayerHealth"); //TakeDamage (health - PlayerPrefs.GetInt ("247127CurrentPlayerHealth"), false); } else { health = 3; PlayerPrefs.SetInt("247127CurrentPlayerHealth", health); } if (PlayerPrefs.HasKey("247127CurrentPlayerLives")) { lives = PlayerPrefs.GetInt("247127CurrentPlayerLives"); //if (lives <= 0) //SceneManager.LoadScene (2); } else { lives = 2; PlayerPrefs.SetInt("247127CurrentPlayerLives", lives); } if (lives <= 0) { SceneManager.LoadScene(2); } }
// Use this for initialization void Start() { displayLives = GetComponentInChildren <DisplayLives>(); defaultTimeValue = Time.timeScale; //scoreText = GetComponentInChildren<ScoreText>(); //scoreText.UpdateScore(score); // Show current score scoreText.text = score.ToString(); }