armory/Sources/armory/logicnode/LoopNode.hx
2019-12-19 23:54:08 +01:00

31 lines
473 B
Haxe

package armory.logicnode;
class LoopNode extends LogicNode {
var index: Int;
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
index = 0;
var from: Int = inputs[1].get();
var to: Int = inputs[2].get();
for (i in from...to) {
index = i;
runOutput(0);
if (tree.loopBreak) {
tree.loopBreak = false;
break;
}
}
runOutput(2);
}
override function get(from: Int): Dynamic {
return index;
}
}