public void DecreaseLives() { //decrement the lives lives--; //update the hud if (hud != null) { hud.SetLives(lives); } //if there are no more lives then end the game if (lives <= 0) { ShowEnd(); } }
//The start method void Start() { //have the timer count equal to the timer start timerCount = timerStart; //set the reset timer timeRemaining = 1; //get the hud script in order to change the number of icons on the hud hud = this.transform.GetComponent <HudScript>(); //if the hud script was found set the current amount of lives if (hud != null) { hud.SetLives(lives); } menuObj = GameObject.Find("MenuLogic(Clone)"); if (menuObj != null) { menuScript = menuObj.GetComponent <MenuScript>(); } }