I have 2D animations for look, walk, and attack -- each with 4 directions -- for a total of 12 animation clips. The animation controller has the following parameters:
- facing (integer)
- isMoving (boolean)
- isAttacking (trigger)
I want only one clip to be playing at a time. It's working for the look and walk animations because those are mutually exclusive based on their parameters. The problem is the attack clip since that's based on a trigger. When I enter that state, it blends with the look or walk animation that is already playing. When I enter the attack animation, I want the current animation to stop and the attack animation to run to completion before the look or walk animation plays again.
Preferably, I want to do this by having transitions only go from Any State
to each other state (no interstate transitions). I have a bunch of these animations for different characters and equipment, plus I'll have a few more types of animations beyond look/walk/attack in the future, so I'd like to avoid the complexity that'll come with adding a few dozen more transitions.
I thought about changing the isAttacking
parameter from a trigger to a boolean, but that seems like a bad choice because then I'll have to have code and an animation event to keep track of my attack animation and set isAttacking
to false when it's done playing, and that seems to add complexity and bloat to the system