Slightly different solution to stopAttack behaviour

I’ve come up with a slightly different solution following Rick’s breakdown of what the bug was, but before he present us with the solution.

This follows from the logic that “stopAttack” shouldn’t be triggered if we’re already out of the “Attack” state. So by doing a check, the trigger will only be called if we’re in “Attack” state and the other waiting transition to Locomotion hasn’t occured.

            if (GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).IsName("Attack"))


I believe this approaches follows more logically the logic of the problem, and prevent both options of a multi-transition to be able to trigger simultaneously.

The only problem is the verbosity of this, which we can extract into a method to clean it up.

Privacy & Terms