Package com.mygdx.auber.Pathfinding
Class GraphCreator
- java.lang.Object
-
- com.badlogic.gdx.ApplicationAdapter
-
- com.mygdx.auber.Pathfinding.GraphCreator
-
- All Implemented Interfaces:
com.badlogic.gdx.ApplicationListener
public final class GraphCreator extends com.badlogic.gdx.ApplicationAdapter
-
-
Constructor Summary
Constructors Constructor Description GraphCreator(com.badlogic.gdx.maps.tiled.TiledMapTileLayer chosenTileLayer)The constructor for this MapGraph.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()voidgenerateConnections()Generates a path from each node to its neighbour nodes (up, down, left, right).voidgenerateNodeMap()Generates a node on every tile in the map, if it matches the id.static com.badlogic.gdx.utils.Array<Node>getKeySystemNodes()Returns the key system nodes for this GraphCreator.MapGraphgetMapGraph()Gets this GraphCreator's mapGraph.com.badlogic.gdx.utils.Array<Node>getNeighbourNodes(Node node)Returns every valid neighbour node to the node passed as input.voidrender()Renders the nodes and paths on the screen using their render methods, used for debugging purposes.static voidsetNodePath(com.badlogic.gdx.ai.pfa.GraphPath<Node> inputNodePath)Sets the nodePath for this GraphCreator.
-
-
-
Method Detail
-
render
public void render()
Renders the nodes and paths on the screen using their render methods, used for debugging purposes.- Specified by:
renderin interfacecom.badlogic.gdx.ApplicationListener- Overrides:
renderin classcom.badlogic.gdx.ApplicationAdapter
-
generateNodeMap
public void generateNodeMap()
Generates a node on every tile in the map, if it matches the id. This is called when the GraphCreator object is instantiated.
-
generateConnections
public void generateConnections()
Generates a path from each node to its neighbour nodes (up, down, left, right). Called when GraphCreator is instantiated, after the nodes are created.
-
getNeighbourNodes
public com.badlogic.gdx.utils.Array<Node> getNeighbourNodes(Node node)
Returns every valid neighbour node to the node passed as input.- Parameters:
node- Node to get neighbours for- Returns:
- Array of Nodes
-
getMapGraph
public MapGraph getMapGraph()
Gets this GraphCreator's mapGraph.- Returns:
- This GraphCreator's mapGraph.
-
setNodePath
public static void setNodePath(com.badlogic.gdx.ai.pfa.GraphPath<Node> inputNodePath)
Sets the nodePath for this GraphCreator.- Parameters:
inputNodePath- The new node path for this GraphCreator.
-
getKeySystemNodes
public static com.badlogic.gdx.utils.Array<Node> getKeySystemNodes()
Returns the key system nodes for this GraphCreator.- Returns:
- An array of nodes that represent key systems.
-
dispose
public void dispose()
- Specified by:
disposein interfacecom.badlogic.gdx.ApplicationListener- Overrides:
disposein classcom.badlogic.gdx.ApplicationAdapter
-
-