Esempio n. 1
0
        public Maze CreateMase(MazeFactory mazeFactory)
        {
            Maze aMaze   = mazeFactory.MakeMaze();
            Room r1      = mazeFactory.MakeRoom(1);
            Room r2      = mazeFactory.MakeRoom(2);
            Door theDoor = mazeFactory.MakeDoor(r1, r2);

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

            r1.SetSide(Direction.North, mazeFactory.MakeWall());
            r1.SetSide(Direction.East, theDoor);
            r1.SetSide(Direction.South, mazeFactory.MakeWall());
            r1.SetSide(Direction.West, mazeFactory.MakeWall());
            r2.SetSide(Direction.North, mazeFactory.MakeWall());
            r2.SetSide(Direction.East, mazeFactory.MakeWall());
            r2.SetSide(Direction.South, mazeFactory.MakeWall());
            r2.SetSide(Direction.West, theDoor);
            return(aMaze);
        }
Esempio n. 2
0
        static Maze CreateMaze(MazeFactory factory)
        {
            var maze  = factory.MakeMaze();
            var room1 = factory.MakeRoom(1);
            var room2 = factory.MakeRoom(2);

            var door = factory.MakeDoor(room1, room2);


            maze.AddRoom(room1);
            maze.AddRoom(room2);

            room1.SetSide(Direction.North, factory.MakeWall());
            room1.SetSide(Direction.East, door);
            room1.SetSide(Direction.South, factory.MakeWall());
            room1.SetSide(Direction.West, factory.MakeWall());

            room2.SetSide(Direction.North, factory.MakeWall());
            room2.SetSide(Direction.East, factory.MakeWall());
            room2.SetSide(Direction.South, factory.MakeWall());
            room2.SetSide(Direction.West, door);

            return(maze);
        }