public void PlayerMove(Direction dir) { if (_state == GameState.WaitingForPlayerCommand) { if (!_playerMovable.CanMove(this, dir)) { // If player cant move, discard the turn attempt return; } // Player moves first var playerId = _playerEntity.Id; Dispatch(new MoveCommand(playerId, dir, true)); // Rest of the objects move afterwards foreach (var entity in _entities.Values) { if (entity.IsActive) { entity.OnAfterPlayerMove(this); } } // Proceed to executing turns SwitchState(GameState.ExecutingTurnCommands); } }