Class 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
      void dispose()  
      void generateConnections()
      Generates a path from each node to its neighbour nodes (up, down, left, right).
      void generateNodeMap()
      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.
      MapGraph getMapGraph()
      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.
      void render()
      Renders the nodes and paths on the screen using their render methods, used for debugging purposes.
      static void setNodePath​(com.badlogic.gdx.ai.pfa.GraphPath<Node> inputNodePath)
      Sets the nodePath for this GraphCreator.
      • Methods inherited from class com.badlogic.gdx.ApplicationAdapter

        create, pause, resize, resume
      • Methods inherited from class java.lang.Object

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

      • GraphCreator

        public GraphCreator​(com.badlogic.gdx.maps.tiled.TiledMapTileLayer chosenTileLayer)
        The constructor for this MapGraph.
        Parameters:
        chosenTileLayer - the layer on the map to check for the data.
    • Method Detail

      • render

        public void render()
        Renders the nodes and paths on the screen using their render methods, used for debugging purposes.
        Specified by:
        render in interface com.badlogic.gdx.ApplicationListener
        Overrides:
        render in class com.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:
        dispose in interface com.badlogic.gdx.ApplicationListener
        Overrides:
        dispose in class com.badlogic.gdx.ApplicationAdapter