Class PathFinder<T extends Locatable>

    • Constructor Summary

      Constructors 
      Constructor Description
      PathFinder()  
      PathFinder​(int maxDepth, boolean allowDiagonal)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addBlacklistedTile​(Tile t)  
      void addObstacle​(PathObstacle po)
      ****Used By Local Path Finders Only**** Adds an obstacle to the obstacle choices list.
      AbstractPath<T> calculate​(int x1, int y1, int x2, int y2)
      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.
      AbstractPath<T> calculate​(int x1, int y1, int x2, int y2, int z)
      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.
      abstract AbstractPath<T> calculate​(int x1, int y1, int z1, int x2, int y2, int z2)
      Calculates an AbstracPath from the start location (x1,y1,z1) to the destination tile locaion (x2,y2,z2)
      AbstractPath<T> calculate​(Tile s, Tile e)
      Calculates an AbstractPath from Tile s to Tile e
      void clearBlacklist()  
      java.lang.String getDirection​(int sx, int sy, int ex, int ey)  
      float getMovementCost​(int sx, int sy, int ex, int ey, int z)  
      PathNode getNode​(int x, int y, int z)  
      PathObstacle getObstacle​(int x, int y, int z, int dir)  
      boolean hasObstacle​(int x, int y, int z, int dir)  
      boolean isBlacklisted​(Tile t)  
      boolean isDirWall​(java.lang.String dir, int flag)  
      void removeObstacle​(PathObstacle obstacle)
      ****Used By Local Path Finders Only**** Removes the obstacle from the available obstacles of this pathfinder
      void reset()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathFinder

        public PathFinder​(int maxDepth,
                          boolean allowDiagonal)
      • PathFinder

        public PathFinder()
    • Method Detail

      • addBlacklistedTile

        public void addBlacklistedTile​(Tile t)
      • isBlacklisted

        public boolean isBlacklisted​(Tile t)
      • clearBlacklist

        public void clearBlacklist()
      • calculate

        public AbstractPath<T> calculate​(Tile s,
                                         Tile e)
        Calculates an AbstractPath from Tile s to Tile e
        Parameters:
        s - Start Tile
        e - End Tile
        Returns:
        AbstractPath
      • calculate

        public AbstractPath<T> calculate​(int x1,
                                         int y1,
                                         int x2,
                                         int y2)
        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
        Parameters:
        x1 - the starting grid X coordinate.
        y1 - the starting grid Y coordinate.
        x2 - the destination grid X coordinate.
        y2 - 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 AbstractPath<T> calculate​(int x1,
                                         int y1,
                                         int x2,
                                         int y2,
                                         int z)
        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.
        Parameters:
        x1 - the starting grid X coordinate.
        y1 - the starting grid Y coordinate.
        x2 - the destination grid X coordinate.
        y2 - 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.
      • calculate

        public abstract AbstractPath<T> calculate​(int x1,
                                                  int y1,
                                                  int z1,
                                                  int x2,
                                                  int y2,
                                                  int z2)
        Calculates an AbstracPath from the start location (x1,y1,z1) to the destination tile locaion (x2,y2,z2)
        Parameters:
        x1 - the starting grid X coordinate.
        y1 - the starting grid Y coordinate.
        z1 - the starting grid Z coordinate.
        x2 - the destination grid X coordinate.
        y2 - the destination grid Y coordinate.
        z2 - the destination grid Z coordinate
        Returns:
        AbstractPath
      • addObstacle

        public void addObstacle​(PathObstacle po)
        ****Used By Local Path Finders Only**** Adds an obstacle to the obstacle choices list. When creating the obstacle, give it the obstacle name, action, and then set the three Tile arguments to null. Local Path Finders are AStarPathFinder and DijkstraPathFinder
        Parameters:
        po -
      • removeObstacle

        public void removeObstacle​(PathObstacle obstacle)
        ****Used By Local Path Finders Only**** Removes the obstacle from the available obstacles of this pathfinder

        Local Path Finders are AStarPathFinder and DijkstraPathFinder

        Parameters:
        obstacle - the obstacle to remove from the pathfinder
      • getMovementCost

        public float getMovementCost​(int sx,
                                     int sy,
                                     int ex,
                                     int ey,
                                     int z)
      • getNode

        public PathNode getNode​(int x,
                                int y,
                                int z)
      • hasObstacle

        public boolean hasObstacle​(int x,
                                   int y,
                                   int z,
                                   int dir)
      • getObstacle

        public PathObstacle getObstacle​(int x,
                                        int y,
                                        int z,
                                        int dir)
      • isDirWall

        public boolean isDirWall​(java.lang.String dir,
                                 int flag)
      • getDirection

        public java.lang.String getDirection​(int sx,
                                             int sy,
                                             int ex,
                                             int ey)
      • reset

        public void reset()