I have a base class for Abilities. This is a point and click game, therefore I have Click, Hold and Drag subclasses.
What I need to do is remind myself to set the player's AI state to Ability when it casts, and then back to Idle when the cast is over. The will be needed in various spots of the abilities code depending on how complex it is.
For example, Clicking to dash is easy. I set the AI state to Ability, then Cast dash (one frame), then set the AI state to Idle (reset AI).
But this becomes complicated for something like a leap. I won't set the AI state to Ability until I trigger DragEnd (mouse up after a drag), and I won't set the AI state back to Idle until the animation and damage completes.
Point is, there's no telling where I'll need to set the Ability and Idle AI states. However, I forget to do this pretty often and I can't think of any good way to enforce using these variables/setting these states in C#.
Any ideas?