Question by
onuruzun78 · May 20, 2020 at 11:10 AM ·
intresethow to
How to Reset my int healt ?
//PLAYER STATS
public int cherries = 0;
public int health = 5;
public TextMeshProUGUI cherryText;
public Text healthAmount;
public AudioSource hurtsound;
public static PermanentUI perm;
private void Start()
{
DontDestroyOnLoad(gameObject);
if (!perm)
{
perm = this;
}
else
Destroy(gameObject);
}
public void Reset()
{
cherries = 0;
cherryText.text = cherries.ToString();
}
--------------------------------------------------------------------
------------------------------------------------------------------
//PlayerController
private void HandleHealth()
{
PermanentUI.perm.health -= 1;
PermanentUI.perm.healthAmount.text = PermanentUI.perm.health.ToString();
if (PermanentUI.perm.health <= 0)
{
onst string SceneName = "Menu";
SceneManager.LoadScene(SceneName);
}
}
Greetings everyone. if my healt <= 0, i can reset the game but i can not reset my healt for 5. How can i dot that. Im new i know you can answer easily my noob question:) Thanks a lot .
Comment
Your answer
Follow this Question
Related Questions
How can i reset the count down timer when my player collides with an object 2 Answers
i am making a pong game and it works fine till i reset the game 1 Answer
Reset button in an one scene game 0 Answers
random range to pick from two specific numbers only. 3 Answers
NetworkIdentity.netID to int 3 Answers