armory/Sources/armory/logicnode/ArrayNode.hx

28 lines
485 B
Haxe
Raw Normal View History

2017-04-04 23:11:31 +02:00
package armory.logicnode;
2017-04-08 20:05:35 +02:00
class ArrayNode extends LogicNode {
2017-04-04 23:11:31 +02:00
2019-12-19 23:54:08 +01:00
public var value: Array<Dynamic> = [];
2017-04-08 00:34:45 +02:00
var initialized = false;
2017-04-04 23:11:31 +02:00
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-04-04 23:11:31 +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: Dynamic = inp.get();
2017-04-08 00:34:45 +02:00
value.push(val);
}
}
2017-04-04 23:11:31 +02:00
return from == 0 ? value : value.length;
}
2019-12-19 23:54:08 +01:00
override function set(value: Dynamic) {
2017-04-04 23:11:31 +02:00
this.value = value;
}
}