void Start() { PlayerPrefs.SetInt ("levelScore", 0); mCurrentLevel = PlayerPrefs.GetInt ("currentLevel"); if (mCurrentLevel > 0) { levelText.text = "Level " + mCurrentLevel.ToString (); } else { levelText.text = "Level 1"; } gameOver = false; //isWindowShown = false; Load (); _scoreFloat = 1000; mInvulnerabilityCountDown = 10; scoreText.text = Mathf.RoundToInt(_scoreFloat).ToString(); numCansText.text = "x" + _numCans; GameObject playerObject = GameObject.FindWithTag ("Player"); GameObject invulnerabilityObject = GameObject.FindWithTag("Invulnerability"); if (playerObject != null) { playerController = playerObject.GetComponent <TooBeeController>(); //get this instance's own game controller connection } if (playerController == null) { Debug.Log("Cannot find 'GameController' script"); //logging in case unable to find gamecontroller } //trying to connect invulnerabilityColision to this class if (invulnerabilityObject != null) { invulnerabilityColision = invulnerabilityObject.GetComponent <InvulnerabilityColision>(); //get this instance's own game controller connection } if (invulnerabilityColision == null) { Debug.Log("Cannot find 'invulnerability' script"); //logging in case unable to find gamecontroller } UpdateScore(); _lives = PlayerPrefs.GetInt("lives"); if (extraLife > 0) { _lives += extraLife; } if (_lives > 3) { _lives = 3; } if (_lives < 3) { removeHeads(_lives); } waterGoal = GameObject.FindWithTag ("Water"); playerController.setNumCans(_numCans); playerController.GetComponent<ParticleSystem>().Stop(); }
void Start() { PlayerPrefs.SetInt("levelScore", 0); mCurrentLevel = PlayerPrefs.GetInt("currentLevel"); if (mCurrentLevel > 0) { levelText.text = "Level " + mCurrentLevel.ToString(); } else { levelText.text = "Level 1"; } gameOver = false; //isWindowShown = false; Load(); _scoreFloat = 1000; mInvulnerabilityCountDown = 10; scoreText.text = Mathf.RoundToInt(_scoreFloat).ToString(); numCansText.text = "x" + _numCans; GameObject playerObject = GameObject.FindWithTag("Player"); GameObject invulnerabilityObject = GameObject.FindWithTag("Invulnerability"); if (playerObject != null) { playerController = playerObject.GetComponent <TooBeeController>(); //get this instance's own game controller connection } if (playerController == null) { Debug.Log("Cannot find 'GameController' script"); //logging in case unable to find gamecontroller } //trying to connect invulnerabilityColision to this class if (invulnerabilityObject != null) { invulnerabilityColision = invulnerabilityObject.GetComponent <InvulnerabilityColision>(); //get this instance's own game controller connection } if (invulnerabilityColision == null) { Debug.Log("Cannot find 'invulnerability' script"); //logging in case unable to find gamecontroller } UpdateScore(); _lives = PlayerPrefs.GetInt("lives"); if (extraLife > 0) { _lives += extraLife; } if (_lives > 3) { _lives = 3; } if (_lives < 3) { removeHeads(_lives); } waterGoal = GameObject.FindWithTag("Water"); playerController.setNumCans(_numCans); playerController.GetComponent <ParticleSystem>().Stop(); }