Ejemplo n.º 1
0
        // Non-flexible implemantation, replaced.
        //public static Maze CreateMaze()
        //{
        //    Maze maze = new Maze();
        //    Room room1 = new Room(1);
        //    Room room2 = new Room(2);
        //    Door door = new Door(room1, room2);

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

        //    room1.SetSide(Direction.North, new Wall());
        //    room1.SetSide(Direction.East, door);
        //    room1.SetSide(Direction.South, new Wall());
        //    room1.SetSide(Direction.West, new Wall());

        //    room2.SetSide(Direction.North, new Wall());
        //    room2.SetSide(Direction.East, new Wall());
        //    room2.SetSide(Direction.South, new Wall());
        //    room2.SetSide(Direction.West, door);

        //    return maze;
        //}

        public static Maze CreateMaze(MazeFactory factory)
        {
            Maze maze  = factory.MakeMaze();
            Room room1 = factory.MakeRoom(1);
            Room room2 = factory.MakeRoom(2);
            Door door  = factory.MakeDoor(room1, room2);

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

            ConnectFromEastToWest(room1, room2, door);

            return(maze);
        }
Ejemplo n.º 2
0
        public Maze CreateMaze(MazeFactory factory)
        {
            Maze aMaze = factory.MakeMaze();
            Room r1 = factory.MakeRoom(1);
            Room r2 = factory.MakeRoom(2);
            Door theDoor = factory.MakeDoor(r1,r2);

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

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

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

            return aMaze;
        }
Ejemplo n.º 3
0
        public Maze CreateMaze(MazeFactory factory)
        {
            Maze aMaze   = factory.MakeMaze();
            Room r1      = factory.MakeRoom(1);
            Room r2      = factory.MakeRoom(2);
            Door theDoor = factory.MakeDoor(r1, r2);

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

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

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

            return(aMaze);
        }
Ejemplo n.º 4
0
        public void CreateMaze(MazeFactory factory, MazeType mazeType = MazeType.Prime)
        {
            _maze = factory.MakeMaze(_gameSizeH, _gameSizeW, mazeType);

            SetGameParameters();
        }