I have a 2D Shmup and when my playerCurrentHealth is 1 || 2 (1 or 2) I want aPartSys to Play.() (Loop…) If and when it changes (0 or 3 or more) via power ups, death etc, it resets to Stop() Now, I’ve read that if you Stop or enable it, it looks unnatural. I would agree. I want it to stop then let the last that have been emitted play out as it were so it doesn’t disappear.
Anyway, its not starting or stopping with these C# commands so, I think I may have missed something here.
You dont have a closing bracket after line 5. Also, you can only do NO brackets only when there is one line after the else. So, if it was just line 8 it would be fine but since you have additional code after the else, you need to add brackets before 8 and after 9. Here:
public void PlayerLowHealthWarn()
{
if ((playerCurrentHealth == 2) || playerCurrentHealth == 1)
{
playerAnimator.SetBool("LowHealthWarn", true);
Debug.Log("Player's current health is " + playerCurrentHealth);
}
else
{
playerAnimator.SetBool("LowHealthWarn", false);
deathSmoke.enableEmission = false;
Debug.Log("Stop particles");
}
}