I made a hierarchical state machine implementation (or statecharts, depending on how you view it) for C# that allows me to write my nested states using inheritance just like you would with the state pattern. It has an experimental source generator I have been working on that reads your code and produces the UML diagram so you can see what your code looks like based on its inputs, the state changes, and the outputs produced.<p>The source generator probably needs some major improvements to be truly robust, but I've already found it to be incredibly helpful for the game I'm making and some other projects. It's really nice to be able to quickly glance at a diagram as you're making changes to the code to verify if it's what you intended.<p>Hope you like it :))