public override void BuildRoom(int roomNo)
 { //if (currentMaze.RoomNo(roomNo) == null)
     {
         Room room = new Room(roomNo);
         room.Enter();
         currentMaze.AddRoom(room);
         room.SetSide(Direction.North, new Wall());
         room.SetSide(Direction.South, new Wall());
         room.SetSide(Direction.East, new Wall());
         room.SetSide(Direction.West, new Wall());
     }
 }
Example #2
0
        // Методы CreateMaze - создает лабиринт из двух комнат с одной дверью между комнатами.

        // Использование Фабричных методов.
        public Maze CreateMaze()
        {
            Maze aMaze = this.MakeMaze();

            Room r1      = MakeRoom(1);
            Room r2      = MakeRoom(2);
            Door theDoor = MakeDoor(r1, r2);

            aMaze.AddRoom(r1);
            aMaze.AddRoom(r2);

            r1.SetSide(Direction.North, MakeWall());
            r1.SetSide(Direction.East, theDoor);
            r1.SetSide(Direction.South, MakeWall());
            r1.SetSide(Direction.West, MakeWall());

            r2.SetSide(Direction.North, MakeWall());
            r2.SetSide(Direction.East, MakeWall());
            r2.SetSide(Direction.South, MakeWall());
            r2.SetSide(Direction.West, theDoor);

            return(aMaze);
        }
Example #3
0
        public Maze CreateMaze()
        {
            Maze aMaze = new Maze();
            Room r1    = new Room(1);

            r1.Enter();
            Room r2 = new Room(2);

            r2.Enter();
            Door theDoor = new Door(r1, r2);

            theDoor.Enter();
            aMaze.AddRoom(r1);
            aMaze.AddRoom(r2);
            r1.SetSide(Direction.North, new Wall());
            r1.SetSide(Direction.East, theDoor);
            r1.SetSide(Direction.South, new Wall());
            r1.SetSide(Direction.West, new Wall());
            r2.SetSide(Direction.North, new Wall());
            r2.SetSide(Direction.East, new Wall());
            r2.SetSide(Direction.South, new Wall());
            r2.SetSide(Direction.West, theDoor);
            return(aMaze);
        }