private void MovePlayer() { UserMessage message; int testRoomIndex; Point previewMove = player.PreviewMove(player.CurrentDirection); switch (CollisionDetection(previewMove)) { case ObjectType.None: player.Move(previewMove); break; case ObjectType.Door: if (currentRoom.RoomWarp == null) { testRoomIndex = currentRoom.GetNextRoom(player.CurrentDirection); if (testRoomIndex == -1) { this.GameResult = Castle.GameResult.Win; EndGame(); if (StopGamePlay != null) { StopGamePlay(this, new EventArgs()); } return; } if (mapReader.FindRoom(testRoomIndex).Dark) { if (ItemManager.FindItemInInventory("Lamp") != null) { currentRoomIndex = testRoomIndex; MovePlayerRoom(previewMove); DrawRoom(); } else { message = new UserMessage(); message.AddLine("It's too dark"); message.AddLine("to go that way"); PrintUserMessage(message); } } else { currentRoomIndex = testRoomIndex; MovePlayerRoom(previewMove); DrawRoom(); } } else { currentRoomIndex = currentRoom.RoomWarp.DestinationRoomId; previewMove.X = currentRoom.RoomWarp.X; previewMove.Y = currentRoom.RoomWarp.Y; message = currentRoom.RoomWarp.UserMessage; player.Move(previewMove); DrawRoom(); PrintUserMessage(message); } break; case ObjectType.UpStairs: currentRoomIndex = currentRoom.GetNextRoom(Direction.UpStairs); DrawRoom(); break; case ObjectType.DownStairs: testRoomIndex = currentRoom.GetNextRoom(Direction.DownStairs); if (mapReader.FindRoom(testRoomIndex).Dark) { if (ItemManager.FindItemInInventory("Lamp") != null) { currentRoomIndex = currentRoom.GetNextRoom(Direction.DownStairs); DrawRoom(); } else { message = new UserMessage(); message.AddLine("It's too dark"); message.AddLine("to go that way"); PrintUserMessage(message); } } else { currentRoomIndex = currentRoom.GetNextRoom(Direction.DownStairs); DrawRoom(); } break; case ObjectType.LockedDoor: message = new UserMessage(); message.AddLine("The Door is"); message.AddLine("locked"); PrintUserMessage(message); break; case ObjectType.Trap: if (ProcessTrap() == false) { player.Move(previewMove); } break; case ObjectType.Item: PickupItem(previewMove); break; case ObjectType.Monster: AttackMonster(previewMove); break; } }