//public Dictionary public Map() { Maze maze = new Maze(12, 12); maze.Generate(0, 0); Dictionary <Coord, Color> walls = new Dictionary <Coord, Color> { }; Bitmap map_image = (Bitmap)MazeDrawer.Draw(maze).Clone(); Width = map_image.Width; Height = map_image.Height; DiagLen = Math.Sqrt(Width * Width + Height * Height); Tile = Settings.mHeight / Height; for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { var pixel = map_image.GetPixel(x, y); if (pixel != Color.FromArgb(255, 255, 255, 255)) { walls.Add(Coord(x, y), pixel); } } } Walls = new Hashtable(walls); Console.WriteLine("Map init complete!"); }
public Map() { maze = new Maze(Settings.MapSize, Settings.MapSize); maze.Generate(); Dictionary <Coord, Color> walls = new Dictionary <Coord, Color> { }; Image map_image = MazeDrawer.Draw(maze); Width = (int)map_image.Size.X; Height = (int)map_image.Size.Y; DiagLen = Math.Sqrt(Width * Width + Height * Height); Tile = Settings.mHeight / Height; map = new bool[Height, Width]; for (uint y = 0; y < Height; y++) { for (uint x = 0; x < Width; x++) { var pixel = map_image.GetPixel(x, y); if (pixel != new Color(255, 255, 255, 255)) { walls.Add(Coord(x, y), pixel); map[x, y] = true; } } } Out = new Coord((uint)maze.End.X * 2 + 1, (uint)maze.End.Y * 2 + 1); In = new Coord((uint)maze.Start.X * 2 + 1, (uint)maze.Start.Y * 2 + 1); Console.WriteLine("Map init complete!"); }