/// <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);
        }
Exemple #2
0
 /// <summary>
 /// Describes a single adjacent room.
 /// </summary>
 /// <param name="dir">the direction of the adjacent room</param>
 /// <param name="room">the adjacent room</param>
 /// <returns>a description of the adjacent room</returns>
 private string getAdjacentDescription(Direction dir, Room room)
 {
     if (dir == Direction.up || dir == Direction.down)
     {
         return StringManipulator.CapitalizeFirstLetter(dir.ToString()) + " from here is " + room.GetQualifiedName() + '.';
     }
     else
     {
         return "To the " + StringManipulator.CapitalizeFirstLetter(dir.ToString()) + " is " + room.GetQualifiedName() + '.';
     }
 }
Exemple #3
0
 /// <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);
 }
Exemple #4
0
 //===================================================================//
 //                            Actions                                //
 //===================================================================//
 /// <summary>
 /// Creates a connection from one room to another.
 /// This connection is not mutual.
 /// You can travel to the specified room, but not back.
 /// If this room already connects to another in the given direction,
 /// then that connection is replaced with the new one.
 /// </summary>
 /// <param name="room">the room to which a connection is created</param>
 /// <param name="dirToRoom">the direction in which the connection is created</param>
 public void SetAdjacent(Room room, Direction dirToRoom)
 {
     // remove existing connection, if it exists
     if (this.adjacencies.ContainsKey(dirToRoom))
     {
         this.adjacencies.Remove(dirToRoom);
     }
     // add new connection
     this.adjacencies.Add(dirToRoom, room);
 }