Cipriux
Sure this plugin/behavior could be replaced by global/local variable and c2 functions
- Add 2 level case-switch (if...else...) to determine next state
- 1 level for each possible current state, another level to decide next state
- Add some glue logic to trigger "exit previous state, enter current state" event (condition), or "on state changed" event, etc.
This plugin/behavior wraps the previous/current state (global/local variable), "next state" conditions, and state transition events (exit previous , enter current state, etc..) into an object (plugin). It might be more readable.