//Updates stats every 20th frame void Update() { //DELETE BEFORE RELEASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 if (StatKeeper.getHealth() <= 0) //888888888888888888888888888888888888888888888888888888888888888888888888888 { StatKeeper.healPlayer(); //!111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 }//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! frames++; if (frames % 20 == 0) //If the remainder of the current frame divided by 20 is 0 run the function. { UpdateStats(); if (StatKeeper.getHealth() <= 0) { Debug.Log("Player Died !"); Time.timeScale = 0f; preventUIOverlap(); GameOver.SetActive(true); } } }
//Continues the game and revives the player private void ContinueGame() { Debug.Log("clicked"); StatKeeper.healPlayer(); SceneManager.LoadScene(3); }
//Continues the game and revives the player public void ContinueGame() { playerDed = false; StatKeeper.healPlayer(); Debug.Log("Continuing game from the checkpoint"); StatKeeper.resetHoboCoin(); InventoryHandler.resetInventory(); SceneManager.LoadScene(3); }
//Uses one potion and heals the player back to full health public void usePotion() { if (potionAmount > 1 && potionAmount != 0) { potionAmount--; Debug.Log("Potions left :" + potionAmount); StatKeeper.healPlayer(); potionText.text = "Potion (" + potionAmount + ")"; } else if (potionAmount == 1) { potionAmount--; StatKeeper.healPlayer(); potionText.text = "Potion (" + potionAmount + ")"; potionsUsed = true; Potion.SetActive(false); } else { Potion.SetActive(false); } }