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

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