public Maze CreateMaze(MazeFactory mazeFActory) { Maze maze = mazeFActory.MakeMaze(); Room r1 = mazeFActory.MakeRoom(1); Room r2 = mazeFActory.MakeRoom(2); Door theDoor = mazeFActory.MakeDoor(r1, r2); maze.AddRoom(r1); maze.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 maze; }
public static MazeFactory Instance() { if (currentFactory == null) { if (Environment.GetEnvironmentVariable("tempV") == "bomb") { currentFactory = new BombedFactory(); } else if (Environment.GetEnvironmentVariable("tempV") == "ench") { currentFactory = new EnchantedMazeFactory(); } else { currentFactory = new MazeFactory(); } } return currentFactory; }