I’m working on a brawler, which means that the outcome of getting hit is partly determined by how far along an animation is. To make a simple example, let’s say we have an example attack animation with a windup that lasts from frames 1-5, has hitframes from 6-9, and has a cooldown from 10-24. Each of those states interacts with external events differently; if someone gets hit during windup or cooldown they should flinch, but during their hitframe they shouldn’t move. If the player tries to move around, they should stay still during windup and hitframes, but they should be allowed to cancel out of the cooldown animation, and so forth.
The best way I’ve come up with to implement this is by placing a bunch of notifies in every attack whose one and only job is to cast the skeletal mesh running the animation into a character, and then set some arbitrary enum EAnimationState’s value to Windup/Hitframe/Whatever. Once that’s done, every single control input/external interaction can be correctly processed by running the enum through a switch statement, and figuring out what the correct course of action is.
This works, but it feels a little clunky- am I missing an obvious, better way to keep track of frame data/action states during combat?