Exemple #1
0
 public PathMap(Grid <T> _grid, bool _canMoveDiagonally = true, DistanceEstimationAlgorithm _distanceType = DistanceEstimationAlgorithm.Euclidean)
 {
     grid = _grid;
     canMoveDiagonally = _canMoveDiagonally;
     distanceType      = _distanceType;
     InitializeGrid();
 }
Exemple #2
0
 public static List <T> FindPath <T>(Grid <T> _grid, int xstart, int ystart, int xtarget, int ytarget, bool _canMoveDiagonally = true, DistanceEstimationAlgorithm _distanceType = DistanceEstimationAlgorithm.Euclidean) where T : ISolidTile =>
 new PathMap <T>(_grid, _canMoveDiagonally, _distanceType).FindPath(xstart, ystart, xtarget, ytarget);
Exemple #3
0
 /// <summary>
 /// Finds the shortest path from the start point to the target point on the grid
 /// </summary>
 /// <param name="_grid">grid to explore</param>
 /// <param name="xstart">x-position of start point on grid</param>
 /// <param name="ystart">y-position of start point on grid</param>
 /// <param name="xtarget">x-position of target point on grid</param>
 /// <param name="ytarget">y-position of target point on grid</param>
 /// <param name="_canMoveDiagonally">whether the pathfinding can move diagonally</param>
 /// <param name="_distanceType">what type of distance to use (euclidean/manhattan)</param>
 /// <returns>List of tiles in the grid making up the shortest path from the start point to the end point</returns>
 public static List <T> FindPath <T>(Grid <T> _grid, float xstart, float ystart, float xtarget, float ytarget, bool _canMoveDiagonally = true, DistanceEstimationAlgorithm _distanceType = DistanceEstimationAlgorithm.Euclidean) where T : ISolidTile =>
 FindPath(_grid, (int)xstart, (int)ystart, (int)xtarget, (int)ytarget, _canMoveDiagonally, _distanceType);