public void Setup() { maze = new Maze(7, 16); DivisionMethod = new DivisionMethod(); var Cells = DivisionMethod.GenerateMaze(7, 16); maze.Cells = Cells; hero = Player.GetPlayer; }
static void Main(string[] args) { Maze maze = new Maze(7, 16); //Maze maze = new Maze(7, 16); DivisionMethod = new DivisionMethod(); var Cells = DivisionMethod.GenerateMaze(7, 16); //var Cells = DivisionMethod.GenerateMaze(7, 16); maze.Cells = Cells; var instructions = " \n"; var key = new ConsoleKeyInfo(); Console.WriteLine(instructions + Drawer.Create(maze)); while (key.Key != ConsoleKey.Escape) { key = Console.ReadKey(); Console.Clear(); switch (key.Key) { case ConsoleKey.W: case ConsoleKey.UpArrow: { maze.TryToStep(Direction.Up); break; } case ConsoleKey.A: case ConsoleKey.LeftArrow: { maze.TryToStep(Direction.Left); break; } case ConsoleKey.D: case ConsoleKey.RightArrow: { maze.TryToStep(Direction.Right); break; } case ConsoleKey.S: case ConsoleKey.DownArrow: { maze.TryToStep(Direction.Down); break; } } Console.WriteLine(instructions + Drawer.Create(maze)); } }
public Maze(int height, int width, WallGenerationInterface GenAlg = null) { this.Height = height; this.Width = width; Cells = GenAlg.GenerateMaze(height, width); }