Search in sources :

Example 1 with BehaviorState

use of org.terasology.logic.behavior.core.BehaviorState in project Terasology by MovingBlocks.

the class CountCallsTest method assertBT.

public void assertBT(String tree, List<BehaviorState> result, List<Integer> executed, boolean step) {
    BehaviorNode node = fromJson(tree);
    node.construct(null);
    List<BehaviorState> actualStates = Lists.newArrayList();
    for (int i = 0; i < result.size(); i++) {
        BehaviorState state = node.execute(null);
        actualStates.add(state);
    }
    node.destruct(null);
    Assert.assertEquals(result, actualStates);
    Assert.assertEquals(executed, executeCalled);
}
Also used : BehaviorState(org.terasology.logic.behavior.core.BehaviorState) BehaviorNode(org.terasology.logic.behavior.core.BehaviorNode)

Example 2 with BehaviorState

use of org.terasology.logic.behavior.core.BehaviorState in project Terasology by MovingBlocks.

the class RenderableNode method onDraw.

@Override
public void onDraw(Canvas canvas) {
    canvas.drawTexture(texture);
    BehaviorState status = getState();
    String text = getData().displayName + " " + (status != null ? status : "");
    if (collapsed) {
        text += "[+]";
    }
    canvas.drawText(text);
    if (editor != null) {
        canvas.addInteractionRegion(moveListener, getData().description);
    }
    portList.onDraw(canvas);
}
Also used : BehaviorState(org.terasology.logic.behavior.core.BehaviorState)

Aggregations

BehaviorState (org.terasology.logic.behavior.core.BehaviorState)2 BehaviorNode (org.terasology.logic.behavior.core.BehaviorNode)1