Java Code Examples for com.badlogic.gdx.ai.pfa.GraphPath#add()

The following examples show how to use com.badlogic.gdx.ai.pfa.GraphPath#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AStarPathFinder.java    From riiablo with Apache License 2.0 5 votes vote down vote up
protected void generateNodePath(Point2 startNode, GraphPath<Point2> outPath) {
  while (current.parent != null) {
    outPath.add(current);
    current = current.parent;
  }
  outPath.add(startNode);
  outPath.reverse();
}
 
Example 2
Source File: IndexedAStarPathFinder.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
protected void generateConnectionPath (N startNode, GraphPath<Connection<N>> outPath) {

		// Work back along the path, accumulating connections
		// outPath.clear();
		while (current.node != startNode) {
			outPath.add(current.connection);
			current = nodeRecords[graph.getIndex(current.connection.getFromNode())];
		}

		// Reverse the path
		outPath.reverse();
	}
 
Example 3
Source File: IndexedAStarPathFinder.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
protected void generateNodePath (N startNode, GraphPath<N> outPath) {

		// Work back along the path, accumulating nodes
		// outPath.clear();
		while (current.connection != null) {
			outPath.add(current.node);
			current = nodeRecords[graph.getIndex(current.connection.getFromNode())];
		}
		outPath.add(startNode);

		// Reverse the path
		outPath.reverse();
	}