Example usage for com.badlogic.gdx.ai.btree Task getChildCount

List of usage examples for com.badlogic.gdx.ai.btree Task getChildCount

Introduction

In this page you can find the example usage for com.badlogic.gdx.ai.btree Task getChildCount.

Prototype

public int getChildCount() 

Source Link

Document

Returns the number of children of this task.

Usage

From source file:com.badlogic.gdx.ai.tests.BehaviorTreeViewer.java

License:Apache License

private void addToTree(Tree displayTree, TaskNode parentNode, Task<Dog> task, IntArray taskSteps,
        int taskStepIndex) {
    TaskNode node = new TaskNode(task, taskSteps == null ? step - 1 : taskSteps.get(taskStepIndex), skin);
    taskNodes.put(task, node);//from w ww  .j  ava2s  .  com
    if (parentNode == null) {
        displayTree.add(node);
    } else {
        parentNode.add(node);
    }
    for (int i = 0; i < task.getChildCount(); i++) {
        Task<Dog> child = task.getChild(i);
        addToTree(displayTree, node, child, taskSteps, taskStepIndex + 1);
    }
}

From source file:com.badlogic.gdx.ai.tests.btree.BehaviorTreeViewer.java

License:Apache License

private int addToTree(Tree displayTree, TaskNode parentNode, Task<E> task, IntArray taskSteps,
        int taskStepIndex) {
    TaskNode node = new TaskNode(task, this, taskSteps == null ? step - 1 : taskSteps.get(taskStepIndex),
            getSkin());//from ww w  .j av a 2s .co m
    taskNodes.put(task, node);
    if (parentNode == null) {
        displayTree.add(node);
    } else {
        parentNode.add(node);
    }
    taskStepIndex++;
    for (int i = 0; i < task.getChildCount(); i++) {
        Task<E> child = task.getChild(i);
        taskStepIndex = addToTree(displayTree, node, child, taskSteps, taskStepIndex);
    }
    return taskStepIndex;
}