Search in sources :

Example 1 with GridCell

use of org.xguzm.pathfinding.grid.GridCell in project BWAPI4J by OpenBW.

the class YATA method getPath.

public List<TilePosition> getPath(final TilePosition start, final TilePosition end) {
    final GridCell startNode = this.nodes[start.getX()][start.getY()];
    final GridCell endNode = this.nodes[end.getX()][end.getY()];
    final List<GridCell> gridCellPath = this.finder.findPath(startNode, endNode, this.navigationGrid);
    final List<TilePosition> tilePath = new ArrayList<>();
    if (gridCellPath != null) {
        for (final GridCell cell : gridCellPath) {
            tilePath.add(new TilePosition(cell.x, cell.y));
        }
    }
    return tilePath;
}
Also used : TilePosition(org.openbw.bwapi4j.TilePosition) ArrayList(java.util.ArrayList) GridCell(org.xguzm.pathfinding.grid.GridCell)

Aggregations

ArrayList (java.util.ArrayList)1 TilePosition (org.openbw.bwapi4j.TilePosition)1 GridCell (org.xguzm.pathfinding.grid.GridCell)1