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

项目:ns2-scc-profiler    文件:PreferredRouteCalculationSystem.java   
@Override
protected void collectJobs(ImmutableBag<Entity> entities, LinkedList<Job> jobs) {

    final Array<Routable> routables = new Array<>(entities.size());
    for (int a = 0, size = entities.size(); a < size; a++) {
        // set index, this is required for the pathfinding logic.
        final Routable routable = mRoutable.get(entities.get(a));
        routables.add(routable);
        routable.setIndex(a);
    }

    for (Team team : Team.values()) {
        final DefaultIndexedGraph<Routable> graph = new TeamDefaultIndexedGraph(team, routables);

        for (int a = 0, size = entities.size(); a < size; a++) {

            for (int b = a + 1; b < size; b++) {
                jobs.add(new CalculatePreferredRoute(team, graph, entities.get(a), entities.get(b)));
            }
        }
    }
}
项目:ns2-scc-profiler    文件:PreferredRouteCalculationSystem.java   
@Override
protected void collectJobs(ImmutableBag<Entity> entities, LinkedList<Job> jobs) {

    final Array<Routable> routables = new Array<>(entities.size());
    for (int a = 0, size = entities.size(); a < size; a++) {
        // set index, this is required for the pathfinding logic.
        final Routable routable = mRoutable.get(entities.get(a));
        routables.add(routable);
        routable.setIndex(a);
    }

    for (Team team : Team.values()) {
        final DefaultIndexedGraph<Routable> graph = new TeamDefaultIndexedGraph(team, routables);

        for (int a = 0, size = entities.size(); a < size; a++) {

            for (int b = a + 1; b < size; b++) {
                jobs.add(new CalculatePreferredRoute(team, graph, entities.get(a), entities.get(b)));
            }
        }
    }
}
项目:ns2-scc-profiler    文件:PreferredRouteCalculationSystem.java   
public CalculatePreferredRoute(Team team, DefaultIndexedGraph<Routable> graph, Entity entityA, Entity entityB) {
    this.team = team;
    this.graph = graph;
    this.entityA = entityA;
    this.entityB = entityB;

    finder = new IndexedAStarPathFinder<>(graph);
}
项目:ns2-scc-profiler    文件:PreferredRouteCalculationSystem.java   
public CalculatePreferredRoute(Team team, DefaultIndexedGraph<Routable> graph, Entity entityA, Entity entityB) {
    this.team = team;
    this.graph = graph;
    this.entityA = entityA;
    this.entityB = entityB;

    finder = new IndexedAStarPathFinder<>(graph);
}