How can i disable a call temporaly?
I made this:
public void RestarVida()
{
vidaActual--;
}
And then i made a boolean that call "invulnerabilty" when the player hit a collider, how can i disable the call "RestarVida" when the boolean "Invulnerability" is on true?
Answer by streeetwalker · Apr 15, 2020 at 10:02 PM
@DaniGLara, Where ever you do call RestarVida(), do this instead:
if( ! Invulnerability ) RestarVida();
That said, you not need RestarVida() at all if that is the only code in it - it's a waste of processing time and code. Simply delete the entire function and do this instead:
if( ! Invulnerability ) vidaActual--;
Your answer
Follow this Question
Related Questions
Help with Enemy death Animation! 1 Answer
Why doesn't this if-statement work? 1 Answer
[C#] playerHeight not working for FPS Controller 2 Answers
My Bool function is returning False but it should be true in my opinion. Csharp C# 0 Answers
Need to do multiple boolean check for completing level 3 Answers