armory/Sources/armory/logicnode/ArrayObjectNode.hx

30 lines
517 B
Haxe
Raw Normal View History

2017-04-08 00:34:45 +02:00
package armory.logicnode;
2017-11-20 15:16:52 +01:00
import iron.object.Object;
2017-04-08 00:34:45 +02:00
2017-04-08 20:05:35 +02:00
class ArrayObjectNode extends LogicNode {
2017-04-08 00:34:45 +02:00
2019-12-19 23:54:08 +01:00
public var value: Array<Object> = [];
2017-04-08 00:34:45 +02:00
var initialized = false;
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-04-08 00:34:45 +02:00
super(tree);
}
2019-12-19 23:54:08 +01:00
override function get(from: Int): Dynamic {
2017-04-08 00:34:45 +02:00
if (!initialized) {
initialized = true;
for (inp in inputs) {
2019-12-19 23:54:08 +01:00
var val: Object = inp.get();
2017-04-08 00:34:45 +02:00
value.push(val);
}
}
return from == 0 ? value : value.length;
}
2019-12-19 23:54:08 +01:00
override function set(value: Dynamic) {
2017-04-08 00:34:45 +02:00
this.value = value;
}
}