Exemple #1
0
        private void createObjects()
        {
            RoomWithDoor    livingRoom = new RoomWithDoor("Living Room", "an antique carpet", "an oak door with a brass knob");
            RoomWithDoor    kitchen    = new RoomWithDoor("Kitchen", "a wood cook stove", "a screen door");
            Room            diningRoom = new Room("Dining Room", "a cherry dining table with high-back chairs");
            OutsideWithDoor frontYard  = new OutsideWithDoor("Front Yard", "an oak door with a brass knob", true);
            OutsideWithDoor backYard   = new OutsideWithDoor("Back Yard", "a screen door", false);
            Outside         garden     = new Outside("Garden", false);

            livingRoom.DoorLocation = frontYard;
            kitchen.DoorLocation    = backYard;
            backYard.DoorLocation   = kitchen;
            frontYard.DoorLocation  = livingRoom;

            livingRoom.Exits = new Location[] { frontYard, diningRoom };
            kitchen.Exits    = new Location[] { backYard, diningRoom };
            diningRoom.Exits = new Location[] { livingRoom, kitchen };
            frontYard.Exits  = new Location[] { livingRoom, backYard, garden };
            backYard.Exits   = new Location[] { kitchen, frontYard, garden };
            garden.Exits     = new Location[] { frontYard, backYard };

            moveToANewLocation(frontYard);  // start in front yard
        }
Exemple #2
0
        private void createObjects()
        {
            RoomWithDoor livingRoom = new RoomWithDoor("Living Room", "an antique carpet", "an oak door with a brass knob");
            RoomWithDoor kitchen = new RoomWithDoor("Kitchen", "a wood cook stove", "a screen door");
            Room diningRoom = new Room("Dining Room", "a cherry dining table with high-back chairs");
            OutsideWithDoor frontYard = new OutsideWithDoor("Front Yard", "an oak door with a brass knob", true);
            OutsideWithDoor backYard = new OutsideWithDoor("Back Yard", "a screen door", false);
            Outside garden = new Outside("Garden", false);

            livingRoom.DoorLocation = frontYard;
            kitchen.DoorLocation = backYard;
            backYard.DoorLocation = kitchen;
            frontYard.DoorLocation = livingRoom;

            livingRoom.Exits = new Location[] { frontYard, diningRoom };
            kitchen.Exits = new Location[] { backYard, diningRoom };
            diningRoom.Exits = new Location[] { livingRoom, kitchen };
            frontYard.Exits = new Location[] { livingRoom, backYard, garden };
            backYard.Exits = new Location[] { kitchen, frontYard, garden };
            garden.Exits = new Location[] { frontYard, backYard };

            moveToANewLocation(frontYard);  // start in front yard
        }