/// <summary> /// Helper method that initializes the <see cref="player"/> character /// and the <see cref="Room"/>s of the game. /// </summary> private static void initPlayerAndRooms() { player = new Person("You", "How did you get this to display? It's supposed to be masked.", PronounSet.GetSecondPersonSet(), new string[] { "me" }); firstRoom = new Room("Kitchen", "The kitchen is a room where people make food."); Room anotherRoom = new Room("Bedroom", "This is a place where people typically sleep. Its name comes from the piece of furniture, a bed, that usually occupies the room. However, while providing a place to rest is certainly one of a bedroom's important functions, it is also expected to provide several other services. As you may have already guessed, I needed a long description to test my description-displaying."); Room aThirdRoom = new Room("Hallway", "Just a heads up: this is the room I used for testing non-euclidean room connections. It worked."); Room.SetAdjacent(firstRoom, Direction.south, anotherRoom, Direction.north); Room.SetAdjacent(aThirdRoom, Direction.east, anotherRoom, Direction.west); aThirdRoom.SetAdjacent(firstRoom, Direction.southwest); Move(new Thing("table", "a kitchen table", canBeTaken:false), firstRoom); Move(new Thing(), firstRoom); Move(new Thing(), firstRoom); Move(new Thing("bed", "a thing that you sleep on", canBeTaken:false), anotherRoom); Move(new Person("Steve", "The first NPC I made for testing.", PronounSet.GetMaleSet()), anotherRoom); BasicContainer basket = new BasicContainer("basket", "A woven basket."); Move(basket, aThirdRoom); Move(new Thing("flower", "It's a dandylion."), basket); BasicOpenableContainer box = new BasicOpenableContainer("box", "I'm just going through classes I've made, instantiating them.", true); Move(box, aThirdRoom); Move(new Thing("plates", "Some nice dinner plates. This one was for testing plural nouns.", isPlural: true), box); Move(new Clothing("dress", "A cotton dress.", slots:new ClothingSlot[] { ClothingSlot.shirt, ClothingSlot.skirt}), aThirdRoom); Move(player, firstRoom); }
/// <summary> /// Makes two given rooms adjoin to each other in the specified directions. /// Allows for non-euclidean geometry. This intentional, because sometimes I /// like to put non-euclidean geometry in my games. /// </summary> /// <param name="room1">the first room to connect</param> /// <param name="dirToRoom1">the direction to go in, from room2, to get to room1</param> /// <param name="room2">the second room to connect</param> /// <param name="dirToRoom2">the direction to go in, from room1, to get to room2</param> public static void SetAdjacent(Room room1, Direction dirToRoom1, Room room2, Direction dirToRoom2) { room1.SetAdjacent(room2, dirToRoom2); room2.SetAdjacent(room1, dirToRoom1); }