public PathFinder(TileGrid grid) { Grid = grid; if(!grid.IsValidGrid()) { throw new Exception("Non-valid grid!"); } startTime = Environment.TickCount; }
/// <summary> /// Where length and width are the dimensions of the grid. /// </summary> /// <param name="length"></param> /// <param name="width"></param> public AStar(int length, int width) { tiles = new TileGrid(length, width); this.length = length; this.width = width; }
public DepthFirst(TileGrid grid) : base(grid) { path.Add(grid.Start); }
public AStar(TileGrid grid) : base(grid) { Grid = grid; openList.Add(new AStarTile(Grid, Grid.Start, null)); }
public AStarTile(TileGrid baseGrid, Tile baseTile, AStarTile parent) { Grid = baseGrid; BaseTile = baseTile; Parent = parent; }
private void setupLevel() { if(File.Exists("level.bmp")) { System.Drawing.Bitmap img = new System.Drawing.Bitmap("level.bmp"); TileGrid = new TileGrid(img.Width, img.Height); TileGrid.GenFromFile(img); } else { TileGrid = new TileGrid(100, 100); TileGrid.GenEmptyGrid(); } }