Example #1
0
        public PathFinder(TileGrid grid)
        {
            Grid = grid;

            if(!grid.IsValidGrid()) {
                throw new Exception("Non-valid grid!");
            }
            startTime = Environment.TickCount;
        }
Example #2
0
 /// <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;
 }
Example #3
0
 public DepthFirst(TileGrid grid)
     : base(grid)
 {
     path.Add(grid.Start);
 }
Example #4
0
 public AStar(TileGrid grid)
     : base(grid)
 {
     Grid = grid;
     openList.Add(new AStarTile(Grid, Grid.Start, null));
 }
Example #5
0
 public AStarTile(TileGrid baseGrid, Tile baseTile, AStarTile parent)
 {
     Grid = baseGrid;
     BaseTile = baseTile;
     Parent = parent;
 }
Example #6
0
 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();
     }
 }