Class LocalPathFinder


  • public class LocalPathFinder
    extends PathFinder<Tile>
    The local path finder for navigating the local region
    • Method Detail

      • calculate

        public LocalPath<Tile> calculate​(Tile start,
                                         Tile end)
        Description copied from class: PathFinder
        Calculates an AbstractPath from Tile s to Tile e
        Overrides:
        calculate in class PathFinder<Tile>
        Parameters:
        start - Start Tile
        end - End Tile
        Returns:
        AbstractPath
      • calculate

        public LocalPath<Tile> calculate​(int sx,
                                         int sy,
                                         int tx,
                                         int ty)
        Description copied from class: PathFinder
        Calculate a walkable abstract path from the start tile location (sx, sy) to the destination tile location (dx, dy), using data provided by the tile map. Assumes z coordinate is 0
        Overrides:
        calculate in class PathFinder<Tile>
        Parameters:
        sx - the starting grid X coordinate.
        sy - the starting grid Y coordinate.
        tx - the destination grid X coordinate.
        ty - the destination grid Y coordinate.
        Returns:
        the abstract path from the start to destination if a path is found, if unable to find path it will return null.
      • calculate

        public LocalPath<Tile> calculate​(int sx,
                                         int sy,
                                         int sz,
                                         int ex,
                                         int ey,
                                         int ez)
        Description copied from class: PathFinder
        Calculates an AbstracPath from the start location (x1,y1,z1) to the destination tile locaion (x2,y2,z2)
        Specified by:
        calculate in class PathFinder<Tile>
        Parameters:
        sx - the starting grid X coordinate.
        sy - the starting grid Y coordinate.
        sz - the starting grid Z coordinate.
        ex - the destination grid X coordinate.
        ey - the destination grid Y coordinate.
        ez - the destination grid Z coordinate
        Returns:
        AbstractPath
      • calculate

        public LocalPath<Tile> calculate​(int sx,
                                         int sy,
                                         int tx,
                                         int ty,
                                         int z)
        Description copied from class: PathFinder
        Calculate a walkable abstract path from the start tile location (x1, y1,z) to the destination tile location (x2, y2,z), using data provided by the tile map.
        Overrides:
        calculate in class PathFinder<Tile>
        Parameters:
        sx - the starting grid X coordinate.
        sy - the starting grid Y coordinate.
        tx - the destination grid X coordinate.
        ty - the destination grid Y coordinate.
        z - the z coordinate
        Returns:
        the abstract path from the start to destination if a path is found, if unable to find path it will return null.
      • getCurrentDepth

        public int getCurrentDepth()
      • setCurrentDepth

        public void setCurrentDepth​(int currentDepth)
      • getHeuristicCost

        public float getHeuristicCost​(int x,
                                      int y,
                                      int tx,
                                      int ty)
        Get the heuristic cost for the given location. This determines in which order the locations are processed.
        Parameters:
        x - The x coordinate of the tile whose cost is being determined
        y - The y coordinate of the tile whose cost is being determined
        tx - The x coordinate of the target location
        ty - The y coordinate of the target location
        Returns:
        The heuristic cost assigned to the tile
      • getHeuristicCost

        public float getHeuristicCost​(int x,
                                      int y,
                                      int z,
                                      int tx,
                                      int ty,
                                      int tz)