armory/Sources/armory/logicnode/MergeNode.hx

33 lines
595 B
Haxe
Raw Normal View History

2017-04-11 11:28:22 +02:00
package armory.logicnode;
class MergeNode extends LogicNode {
/** Execution mode. **/
public var property0: String;
var lastInputIndex = -1;
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-04-11 11:28:22 +02:00
super(tree);
tree.notifyOnLateUpdate(lateUpdate);
2017-04-11 11:28:22 +02:00
}
2019-12-19 23:54:08 +01:00
override function run(from: Int) {
// Check if there already were executions on the same frame
if (lastInputIndex != -1 && property0 == "once_per_frame") {
return;
}
lastInputIndex = from;
2018-10-22 10:10:33 +02:00
runOutput(0);
2017-04-11 11:28:22 +02:00
}
override function get(from: Int): Dynamic {
return lastInputIndex;
}
function lateUpdate() {
lastInputIndex = -1;
}
2017-04-11 11:28:22 +02:00
}