I would like some helping on figuring out why this OnTriggerEnter doesn’t modify the booleans gotHit and canMove.
This code is supposed to allow my player to be hit by the enemy and play a staggering animation while not allowing my player to move and reduce it’s health, but only the health part works.
void OnTriggerEnter(Collider hit)
{
if (hit.gameObject.name == "L Hand Box")
{
gotHit = true;
health.CurrentVal -= 20;
if (this.anim.GetCurrentAnimatorStateInfo(0).IsName("standing_react_large_gut"))
{
canMove = false;
}
else
{
canMove = true;
}
}
else
{
gotHit = false;
}
}