I am attempting to cancel the first if at signs of death or at thruster <= 0 but every combination of the if statement seems to keep breaking the speed variable and the thruster sprite doesn’t shut off on death or when thruster bar hits 0.
if (Input.GetKeyDown(KeyCode.LeftShift))
{
gameObject.GetComponent<SpriteRenderer>().enabled = true;
player.IncreaseCurrentSpeed(_increaseSpeed);
_thrustersState = true;
}
else if (Input.GetKeyUp(KeyCode.LeftShift))
{
gameObject.GetComponent<SpriteRenderer>().enabled = false;
player.DecreaseCurrentSpeed(_increaseSpeed);
_thrustersState = false;
}
Attempts
playerState() = bool isDead
- gave first if && player.State() != true && thrusterGuage.GetIndex() > 0
- was going to add || additions to second if statement but realized that would decrease the speed variable ever frame so canceled that line of thought.