- Edited
Camp Don't use node based "state machines". It's clunky and a total overkill for a simple system like player/enemy controller.
Put everything into one script and use flags and ifs. There, I said it That's the easiest way to learn the basics of state management. Only when you're familiar with that and your system becomes too complex for handling via flags, then you can start thinking about more elaborate state management, employing dedicated state classes etc...
Imho this type of non-hierarchical state machine often presented in beginner tutorials is confusing, bug prone and generally useless in real life. It's too unwieldy for simple several-state system, yet not flexible enough to manage complex state.