Coordinate game state transitions
- Define menu and playing states and inject their dependencies through constructors.
- Register the states, enter the menu, and request a transition when gameplay starts.
- Check exit conditions before leaving a state and give observers the successful change to update the view.
- Verify that a rejected exit keeps the current state. Await
StopAsyncwhen the game exits.
See asynchronous state machines for a minimal example and fault handling.