First off, I'm not sure what else to call this other than animation precedence . If there's a more common industry term please let me know. But this has always been the bane of my game dev skills.
I have some physics based characters that have different states such as "walking", "climbing", "running", etc. Each of these states have associated animations. Where I'm running into problems is on the animations that aren't tied to a state. For example an "attack" animation should have a higher precedence than "walking" so it should immediately animate then return back to the walking animation. Further still a "take damage" animation would have a higher precedence than "attack" which means it would play then return to walking.
So one, am I looking at this wrong? Should each one of my animations -including the one shot triggered animations like "attack"- be a state? Then I could just craft my FSM as usual and only have to worry about playing an animation that matches the state.
Is there a better way of looking at or handling this whole thing? I know in Unity there's a animation tree that takes care of most of this but I searched the forums and tutorials and didn't find a quick answer.