private void GoToRoom(StringBuilder builder, RoomLinkerBase roomLinker) { if (roomLinker == null) { builder.AppendLine("There is nothing here."); return; } if (!roomLinker.IsOpen) { builder.AppendLine("It's locked."); return; } _currentRoom = roomLinker.GetOppositeRoom(_currentRoom); _currentRoom.Describe(builder); }
private void UseItemAtLocation(StringBuilder builder, string itemName, string locationName) { ItemBase item = GetItemFromInventory(builder, itemName); if (item == null) { return; } RoomLinkerBase target = null; if (locationName == "n" || locationName == "north") { target = _currentRoom.NorthRoomLinker; } else if (locationName == "e" || locationName == "east") { target = _currentRoom.EastRoomLinker; } else if (locationName == "s" || locationName == "south") { target = _currentRoom.SouthRoomLinker; } else if (locationName == "w" || locationName == "west") { target = _currentRoom.WestRoomLinker; } if (target == null) { builder.AppendLine("There is nothing there."); return; } if (target.UseItem(builder, item)) { _inventory.Remove(item); } }