Ejemplo n.º 1
0
        /// <summary>
        /// Sets up the house data structure
        /// </summary>
        static House()
        {
            Entry = new Location("Entry");
            var hallway        = new Location("Hallway");
            var livingRoom     = new Location("Living Room");
            var kitchen        = new Location("Kitchen");
            var bathroom       = new Location("Bathroom");
            var landing        = new Location("Landing");
            var masterBedroom  = new Location("Master Bedroom");
            var masterBath     = new Location("Master Bath");
            var secondBathroom = new Location("Second Bathroom");
            var kidsRoom       = new Location("Kids Room");
            var nursery        = new Location("Nursery");
            var pantry         = new Location("Pantry");
            var attic          = new Location("Attic");
            var garage         = new Location("Garage");

            Entry.AddExit(Direction.East, hallway);
            Entry.AddExit(Direction.Out, garage);
            hallway.AddExit(Direction.Northwest, kitchen);
            hallway.AddExit(Direction.North, bathroom);
            hallway.AddExit(Direction.South, livingRoom);
            hallway.AddExit(Direction.Up, landing);
            landing.AddExit(Direction.Northwest, masterBedroom);
            landing.AddExit(Direction.West, secondBathroom);
            landing.AddExit(Direction.Southwest, nursery);
            landing.AddExit(Direction.South, pantry);
            landing.AddExit(Direction.Southeast, kidsRoom);
            landing.AddExit(Direction.Up, attic);
            masterBedroom.AddExit(Direction.East, masterBath);
        }
        static House()
        {
            Entry = new Location("Entry");
            var hallway        = new Location("Hallway");
            var livingRoom     = new LocationWithHidingPlace("Living Room", "behind the sofa");
            var kitchen        = new LocationWithHidingPlace("Kitchen", "next to the stove");
            var bathroom       = new LocationWithHidingPlace("Bathroom", "behind the door");
            var landing        = new Location("Landing");
            var masterBedroom  = new LocationWithHidingPlace("Master Bedroom", "in the closet");
            var masterBath     = new LocationWithHidingPlace("Master Bath", "in the bathtub");
            var secondBathroom = new LocationWithHidingPlace("Second Bathroom", "in the shower");
            var kidsRoom       = new LocationWithHidingPlace("Kids Room", "under the bed");
            var nursery        = new LocationWithHidingPlace("Nursery", "under the crib");
            var pantry         = new LocationWithHidingPlace("Pantry", "inside a cabinet");
            var attic          = new LocationWithHidingPlace("Attic", "in a trunk");
            var garage         = new LocationWithHidingPlace("Garage", "behind the car");

            Entry.AddExit(Direction.East, hallway);
            Entry.AddExit(Direction.Out, garage);
            hallway.AddExit(Direction.Northwest, kitchen);
            hallway.AddExit(Direction.North, bathroom);
            hallway.AddExit(Direction.South, livingRoom);
            hallway.AddExit(Direction.Up, landing);
            landing.AddExit(Direction.Northwest, masterBedroom);
            landing.AddExit(Direction.West, secondBathroom);
            landing.AddExit(Direction.Southwest, nursery);
            landing.AddExit(Direction.South, pantry);
            landing.AddExit(Direction.Southeast, kidsRoom);
            landing.AddExit(Direction.Up, attic);
            masterBedroom.AddExit(Direction.East, masterBath);

            // Add all of the locations to the private locations collection
            locations = new List <Location>()
            {
                Entry,
                hallway,
                kitchen,
                bathroom,
                livingRoom,
                landing,
                masterBedroom,
                secondBathroom,
                kidsRoom,
                nursery,
                pantry,
                attic,
                garage,
                attic,
                masterBath,
            };
        }