2017-04-11 11:28:22 +02:00
|
|
|
package armory.logicnode;
|
|
|
|
|
|
|
|
class MergeNode extends LogicNode {
|
|
|
|
|
2021-05-22 00:36:58 +02:00
|
|
|
/** 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);
|
2021-05-22 00:36:58 +02:00
|
|
|
tree.notifyOnLateUpdate(lateUpdate);
|
2017-04-11 11:28:22 +02:00
|
|
|
}
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
override function run(from: Int) {
|
2021-05-22 00:36:58 +02:00
|
|
|
// 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
|
|
|
}
|
2021-05-22 00:36:58 +02:00
|
|
|
|
|
|
|
override function get(from: Int): Dynamic {
|
|
|
|
return lastInputIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
function lateUpdate() {
|
|
|
|
lastInputIndex = -1;
|
|
|
|
}
|
2017-04-11 11:28:22 +02:00
|
|
|
}
|