Java 类com.badlogic.gdx.ai.btree.utils.BehaviorTreeParser 实例源码

项目:gdx-ai    文件:SemaphoreGuardTest.java   
@Override
public Actor createActor (Skin skin) {
    // Create the semaphore
    NonBlockingSemaphoreRepository.clear();
    NonBlockingSemaphoreRepository.addSemaphore("dogSemaphore", 1);

    Reader reader = null;
    try {
        // Parse Buddy's tree
        reader = Gdx.files.internal("data/dogSemaphore.tree").reader();
        BehaviorTreeParser<Dog> parser = new BehaviorTreeParser<Dog>(BehaviorTreeParser.DEBUG_HIGH);
        BehaviorTree<Dog> buddyTree = parser.parse(reader, new Dog("Buddy"));

        // Clone Buddy's tree for Snoopy
        BehaviorTree<Dog> snoopyTree = (BehaviorTree<Dog>)buddyTree.cloneTask();
        snoopyTree.setObject(new Dog("Snoopy"));

        // Create split pane
        BehaviorTreeViewer<?> buddyTreeViewer = createTreeViewer(buddyTree.getObject().name, buddyTree, false, skin);
        BehaviorTreeViewer<?> snoopyTreeViewer = createTreeViewer(snoopyTree.getObject().name, snoopyTree, false, skin);
        return new SplitPane(new ScrollPane(buddyTreeViewer, skin), new ScrollPane(snoopyTreeViewer, skin), true, skin,
            "default-horizontal");
    } finally {
        StreamUtils.closeQuietly(reader);
    }
}
项目:gdx-ai    文件:ParseTreeTest.java   
@Override
public Actor createActor (Skin skin) {
    Reader reader = null;
    try {
        reader = Gdx.files.internal("data/dog.tree").reader();
        BehaviorTreeParser<Dog> parser = new BehaviorTreeParser<Dog>(BehaviorTreeParser.DEBUG_HIGH);
        BehaviorTree<Dog> tree = parser.parse(reader, new Dog("Buddy"));
        treeViewer = createTreeViewer(tree.getObject().name, tree, true, skin);

        return new ScrollPane(treeViewer, skin);
    } finally {
        StreamUtils.closeQuietly(reader);
    }
}
项目:gdx-ai    文件:IncludeSubtreeTest.java   
@Override
public Actor createActor (Skin skin) {
    BehaviorTreeLibraryManager libraryManager = BehaviorTreeLibraryManager.getInstance();
    libraryManager.setLibrary(new BehaviorTreeLibrary(BehaviorTreeParser.DEBUG_HIGH));

    String name = lazy ? "data/dogIncludeLazy.tree" : "data/dogInclude.tree";
    BehaviorTree<Dog> tree = libraryManager.createBehaviorTree(name, new Dog("Buddy"));
    BehaviorTreeViewer<?> treeViewer = createTreeViewer(tree.getObject().name, tree, true, skin);

    return new ScrollPane(treeViewer, skin);
}
项目:gdx-ai    文件:ProgrammaticallyCreatedTreeTest.java   
@Override
public Actor createActor (Skin skin) {
    BehaviorTreeLibraryManager libraryManager = BehaviorTreeLibraryManager.getInstance();
    BehaviorTreeLibrary library = new BehaviorTreeLibrary(BehaviorTreeParser.DEBUG_HIGH);
    registerDogBehavior(library);
    libraryManager.setLibrary(library);
    BehaviorTree<Dog> tree = libraryManager.createBehaviorTree("dog", new Dog("Buddy"));
    BehaviorTreeViewer<?> treeViewer = createTreeViewer(tree.getObject().name, tree, true, skin);

    return new ScrollPane(treeViewer, skin);
}
项目:GDXJam    文件:BehaviorTreeComponent.java   
public void createTestTree (Entity entity) {
    BehaviorTreeParser<Entity> parser = new BehaviorTreeParser<Entity>(BehaviorTreeParser.DEBUG_HIGH);
    btree = parser.parse(Gdx.files.internal("btree/squad.tree"), entity);
}