Added state machine based on mvc-game-design.