Java 类com.badlogic.gdx.ai.pfa.Connection 实例源码

项目:jrpg-engine    文件:GameMap.java   
@Override
public Array<Connection<TileCoordinate>> getConnections(final TileCoordinate fromNode) {
    Array<Connection<TileCoordinate>> array = new Array<>();
    if (!isCollision(null, fromNode.getAbove())) {
        array.add(new DefaultConnection<>(getCachedNode(fromNode), getCachedNode(fromNode.getAbove())));
    }
    if (!isCollision(null, fromNode.getBelow())) {
        array.add(new DefaultConnection<>(getCachedNode(fromNode), getCachedNode(fromNode.getBelow())));
    }
    if (!isCollision(null, fromNode.getLeft())) {
        array.add(new DefaultConnection<>(getCachedNode(fromNode), getCachedNode(fromNode.getLeft())));
    }
    if (!isCollision(null, fromNode.getRight())) {
        array.add(new DefaultConnection<>(getCachedNode(fromNode), getCachedNode(fromNode.getRight())));
    }

    return array;
}
项目:ns2-scc-profiler    文件:GridNode.java   
@Override
public Array<Connection<GridNode>> getConnections() {

    if (neighbours == null) {
        neighbours = new Array<>(8);

        for (int dir = 0; dir <= 7; dir++) {
            final int xx = x + xOff[dir];
            final int yy = y + yOff[dir];

            if (xx >= 0 &&
                    yy >= 0 &&
                    xx < graph.width &&
                    yy < graph.height && graph.nodes[yy][xx] != null)
                neighbours.add(new GridConnection<GridNode>(this, graph.nodes[yy][xx],
                        (xOff[dir] == 0 || yOff[dir] == 0 ? 1f : 1.414f) * 10f));
        }
    }

    return neighbours;
}
项目:ns2-scc-profiler    文件:GridNode.java   
@Override
public Array<Connection<GridNode>> getConnections() {

    if (neighbours == null) {
        neighbours = new Array<>(8);

        for (int dir = 0; dir <= 7; dir++) {
            final int xx = x + xOff[dir];
            final int yy = y + yOff[dir];

            if (xx >= 0 &&
                    yy >= 0 &&
                    xx < graph.width &&
                    yy < graph.height && graph.nodes[yy][xx] != null)
                neighbours.add(new GridConnection<GridNode>(this, graph.nodes[yy][xx],
                        (xOff[dir] == 0 || yOff[dir] == 0 ? 1f : 1.414f) * 10f));
        }
    }

    return neighbours;
}
项目:jrpg-engine    文件:PathFinder.java   
public TileCoordinate getNextTarget(final TileCoordinate location, final TileCoordinate destination) {
    final GraphPath<Connection<TileCoordinate>> path = new DefaultGraphPath<>();
    pathFinder.searchConnectionPath(
            graph.getCachedNode(location),
            graph.getCachedNode(destination),
            heuristic,
            path
    );

    return path.getCount() == 0 ? null : path.get(0).getToNode();
}
项目:Inspiration    文件:IndexedAStarPathFinder.java   
@Override
public boolean searchConnectionPath (N startNode, N endNode, Heuristic<N> heuristic, GraphPath<Connection<N>> outPath) {

    // Perform AStar
    boolean found = search(startNode, endNode, heuristic);

    if (found) {
        // Create a path made of connections
        generateConnectionPath(startNode, outPath);
    }

    return found;
}
项目:Inspiration    文件:IndexedAStarPathFinder.java   
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();
    }
项目:Inspiration    文件:MyNode.java   
public MyNode(final int index, final int x, final int y,final String value, final int capacity) {
    this.index = index;
    this.x = x;
    this.y = y;
    this.value = value;
    this.connections = new Array<Connection<MyNode>>(capacity);
}
项目:Pacman_libGdx    文件:AStartPathFinding.java   
public AStartPathFinding(AStarMap map) {
    this.map = map;
    this.pathfinder = new IndexedAStarPathFinder<Node>(createGraph(map));
    this.connectionPath = new DefaultGraphPath<Connection<Node>>();
    this.heuristic = new Heuristic<Node>() {
        @Override
        public float estimate (Node node, Node endNode) {
            // Manhattan distance
            return Math.abs(endNode.x - node.x) + Math.abs(endNode.y - node.y);
        }
  };
}
项目:Pacman_libGdx    文件:Node.java   
public Node(AStarMap map, int x, int y) {
    this.x = x;
    this.y = y;
    this.index = x * map.getHeight() + y;
    this.isWall = false;
    this.connections = new Array<Connection<Node>>();
}
项目:GdxDemo3D    文件:Triangle.java   
public Triangle(Vector3 a, Vector3 b, Vector3 c, int triIndex, int meshPartIndex) {
    this.a = a;
    this.b = b;
    this.c = c;
    this.triIndex = triIndex;
    this.meshPartIndex = meshPartIndex;
    this.centroid = new Vector3(a).add(b).add(c).scl(1f / 3f);
    this.connections = new Array<Connection<Triangle>>();
}
项目:gdx-ai    文件:IndexedAStarPathFinder.java   
@Override
public boolean searchConnectionPath (N startNode, N endNode, Heuristic<N> heuristic, GraphPath<Connection<N>> outPath) {

    // Perform AStar
    boolean found = search(startNode, endNode, heuristic);

    if (found) {
        // Create a path made of connections
        generateConnectionPath(startNode, outPath);
    }

    return found;
}
项目:gdx-ai    文件:IndexedAStarPathFinder.java   
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();
    }
项目:Mindustry    文件:TileGraph.java   
/**return nothing, as this isn't used*/
@Override
public Array<Connection<Tile>> getConnections(Tile fromNode){ return null; }
项目:conquest    文件:Tile.java   
public Array<Connection<Tile>> getContacts() {
    return contacts;
}
项目:conquest    文件:Map.java   
@Override
public Array<Connection<Tile>> getConnections(Tile fromNode) {
    return fromNode.getOwner() == owner ? fromNode.getContacts() : new Array<>();
}
项目:Inspiration    文件:MyNode.java   
public Array<Connection<MyNode>> getConnections() {
    return connections;
}
项目:Inspiration    文件:MyGraph.java   
@Override
public Array<Connection<MyNode>> getConnections (MyNode fromNode) {
    return fromNode.getConnections();
}
项目:Inspiration    文件:IndexedAStarPathFinderTest.java   
public Array<Connection<MyNode>> getConnections () {
    return connections;
}
项目:Inspiration    文件:IndexedAStarPathFinderTest.java   
@Override
public Array<Connection<MyNode>> getConnections (MyNode fromNode) {
    return fromNode.getConnections();
}
项目:AStarPathFindingsSimpleExample    文件:TestNode.java   
@Override
public Array<Connection<TestNode>> getConnections() {
    return mConnections;
}
项目:Pacman_libGdx    文件:AStartPathFinding.java   
@Override
public Array<Connection<Node>> getConnections(Node fromNode) {
    return fromNode.getConnections();
}
项目:Pacman_libGdx    文件:Node.java   
public Array<Connection<Node>> getConnections () {
    return connections;
}
项目:AI_TestBed_v3    文件:FlatTiledNode.java   
public FlatTiledNode (int x, int y, int type, int connectionCapacity) {
    super(x, y, type, new Array<Connection<FlatTiledNode>>(connectionCapacity));
}
项目:AI_TestBed_v3    文件:TiledNode.java   
public TiledNode (int x, int y, int type, Array<Connection<N>> connections) {
    this.x = x;
    this.y = y;
    this.type = type;
    this.connections = connections;
}
项目:AI_TestBed_v3    文件:TiledNode.java   
@Override
public Array<Connection<N>> getConnections () {
    return this.connections;
}
项目:AI_TestBed_v3    文件:Node.java   
@Override
public Array<Connection<Node>> getConnections() {
    return connections;
}
项目:GdxDemo3D    文件:Triangle.java   
public Array<Connection<Triangle>> getConnections() {
    return connections;
}
项目:GdxDemo3D    文件:NavMeshGraph.java   
@Override
@SuppressWarnings("unchecked")
public Array<Connection<Triangle>> getConnections(Triangle fromNode) {
    return (Array<Connection<Triangle>>) (Array<?>) sharedEdges.getValueAt(fromNode.triIndex);
}
项目:ns2-scc-profiler    文件:GridGraph.java   
@Override
public Array<Connection<GridNode>> getConnections(GridNode fromNode) {
    return fromNode.getConnections();
}
项目:ns2-scc-profiler    文件:Routable.java   
@Override
public Array<Connection<Routable>> getConnections() {
    throw new NotImplementedException();
}
项目:ns2-scc-profiler    文件:GridGraph.java   
@Override
public Array<Connection<GridNode>> getConnections(GridNode fromNode) {
    return fromNode.getConnections();
}
项目:ns2-scc-profiler    文件:Routable.java   
@Override
public Array<Connection<Routable>> getConnections() {
    throw new NotImplementedException();
}
项目:gdx-ai    文件:FlatTiledNode.java   
public FlatTiledNode (int x, int y, int type, int connectionCapacity) {
    super(x, y, type, new Array<Connection<FlatTiledNode>>(connectionCapacity));
}
项目:gdx-ai    文件:FlatTiledGraph.java   
@Override
public Array<Connection<FlatTiledNode>> getConnections (FlatTiledNode fromNode) {
    return fromNode.getConnections();
}
项目:gdx-ai    文件:TiledNode.java   
public TiledNode (int x, int y, int type, Array<Connection<N>> connections) {
    this.x = x;
    this.y = y;
    this.type = type;
    this.connections = connections;
}
项目:gdx-ai    文件:TiledNode.java   
public Array<Connection<N>> getConnections () {
    return this.connections;
}
项目:gdx-ai    文件:HierarchicalTiledGraph.java   
@Override
public Array<Connection<HierarchicalTiledNode>> getConnections (HierarchicalTiledNode fromNode) {
    return fromNode.getConnections();
}
项目:gdx-ai    文件:HierarchicalTiledNode.java   
public HierarchicalTiledNode (int x, int y, int type, int index, int connectionCapacity) {
    super(x, y, type, new Array<Connection<HierarchicalTiledNode>>(connectionCapacity));
    this.index = index;
}
项目:gdx-ai    文件:IndexedAStarPathFinderTest.java   
public Array<Connection<MyNode>> getConnections () {
    return connections;
}
项目:gdx-ai    文件:IndexedAStarPathFinderTest.java   
@Override
public Array<Connection<MyNode>> getConnections (MyNode fromNode) {
    return fromNode.getConnections();
}