use of org.terasology.logic.behavior.core.BehaviorTreeRunner in project Terasology by MovingBlocks.
the class CounterTest method assertRun.
private void assertRun(String tree, int executions, String expectedOutput) {
Print.output = new StringBuilder();
BehaviorNode node = treeBuilder.fromJson(tree);
String json = treeBuilder.toJson(node);
BehaviorNode n2 = treeBuilder.fromJson(json);
String json2 = treeBuilder.toJson(n2);
Assert.assertEquals(json, json2);
Actor actor = new Actor(null);
actor.setDelta(0.5f);
BehaviorTreeRunner runner = new DefaultBehaviorTreeRunner(node, actor);
for (int i = 0; i < executions; i++) {
runner.step();
}
Assert.assertEquals(expectedOutput, Print.output.toString());
}
Aggregations