示例#1
0
        private void CreateObjects()
        {
            stairs = new Room("Stairs", "a wooden bannister");
            kitchen = new RoomWithDoor("Kitchen", "stainless steel appliances", "in the cabinet", "a screen door");
            hallway = new RoomWithHidingPlace("Upstairs Hallway", "a picture of a dog", "in the closet");
            bathroom = new RoomWithHidingPlace("Bathroom", "a sink and a toilet", "in the shower");
            diningRoom = new RoomWithHidingPlace("Dining Room", "a crystal chandelier", "in the tall armoire");
            livingRoom = new RoomWithDoor("Living Room", "an antique carpet", "inside the closet", "an oak door with a brass knob");
            masterBedroom = new RoomWithHidingPlace("Master Bedroom", "a large bed", "under the bed");
            secondBedroom = new RoomWithHidingPlace("Second Bedroom", "a small bed", "under the bed");
            frontYard = new OutsideWithDoor("Front Yard", false, "an oak door with a brass knob");
            backYard = new OutsideWithDoor("Back Yard", true, "a screen door");
            driveway = new OutsideWithHidingPlace("Driveway", true, "in the garage");
            garden = new OutsideWithHidingPlace("Garden", false, "inside the shed");

            diningRoom.Exits = new Location[] { livingRoom, kitchen };
            livingRoom.Exits = new Location[] { diningRoom, stairs };
            kitchen.Exits = new Location[] { diningRoom };
            stairs.Exits = new Location[] { livingRoom, hallway };
            hallway.Exits = new Location[] { stairs, bathroom, masterBedroom, secondBedroom };
            bathroom.Exits = new Location[] { hallway };
            masterBedroom.Exits = new Location[] { hallway };
            secondBedroom.Exits = new Location[] { hallway };
            frontYard.Exits = new Location[] { backYard, garden, driveway };
            backYard.Exits = new Location[] { frontYard, garden, driveway };
            garden.Exits = new Location[] { backYard, frontYard };
            driveway.Exits = new Location[] { backYard, frontYard };

            livingRoom.DoorLocation = frontYard;
            frontYard.DoorLocation = livingRoom;
            kitchen.DoorLocation = backYard;
            backYard.DoorLocation = kitchen;
        }
示例#2
0
        private void CreateObjects()
        {
            livingRoom = new RoomWithDoor("Living Room", "an antique carpet",
                                          "inside the closet", "an oak door with a brass handle");
            diningRoom = new RoomWithHidingPlace("Dining Room", "a crystal chandelier",
                                                 "in the tall armoire");
            kitchen = new RoomWithDoor("Kitchen", "stainless steel appliances",
                                       "in the cabinet", "a screen door");
            stairs  = new Room("Stairs", "a wooden bannister");
            hallway = new RoomWithHidingPlace("Upstairs Hallway", "a picture of a dog",
                                              "in the closet");
            bathroom = new RoomWithHidingPlace("Bathroom", "a sink and a toilet",
                                               "in the shower");
            masterBedroom = new RoomWithHidingPlace("Master Bedroom", "a large bed",
                                                    "under the bed");
            secondBedroom = new RoomWithHidingPlace("Second Bedroom", "a small bed",
                                                    "under the bed");

            frontYard = new OutsideWithDoor("Front Yard", false, "a heavy-looking oak door");
            backYard  = new OutsideWithDoor("Back Yard", true, "a screen door");
            garden    = new OutsideWithHidingPlace("Garden", false, "inside the shed");
            driveway  = new OutsideWithHidingPlace("Driveway", true, "in the garage");

            diningRoom.Exits    = new Location[] { livingRoom, kitchen };
            livingRoom.Exits    = new Location[] { diningRoom, stairs };
            kitchen.Exits       = new Location[] { diningRoom };
            stairs.Exits        = new Location[] { livingRoom, hallway };
            hallway.Exits       = new Location[] { stairs, bathroom, masterBedroom, secondBedroom };
            bathroom.Exits      = new Location[] { hallway };
            masterBedroom.Exits = new Location[] { hallway };
            secondBedroom.Exits = new Location[] { hallway };
            frontYard.Exits     = new Location[] { backYard, garden, driveway };
            backYard.Exits      = new Location[] { frontYard, garden, driveway };
            garden.Exits        = new Location[] { backYard, frontYard };
            driveway.Exits      = new Location[] { backYard, frontYard };

            livingRoom.DoorLocation = frontYard;
            frontYard.DoorLocation  = livingRoom;

            kitchen.DoorLocation  = backYard;
            backYard.DoorLocation = kitchen;
        }