/
LogicTree.hx
47 lines (35 loc) · 1.06 KB
/
LogicTree.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package armory.logicnode;
class LogicTree extends iron.Trait {
#if arm_patch
/**
Stores all trait instances of the tree via its name.
**/
public static var nodeTrees = new Map<String, Array<LogicTree>>();
/**
[node name => logic node] for later node replacement for live patching.
**/
public var nodes: Map<String, LogicNode>;
#end
public var loopBreak = false; // Trigger break from loop nodes
public var loopContinue = false; // Trigger Continue from loop nodes
public function new() {
super();
#if arm_patch
nodes = new Map<String, LogicNode>();
#end
}
public function add() {}
public var paused = false;
public function pause() {
if (paused) return;
paused = true;
if (_update != null) for (f in _update) iron.App.removeUpdate(f);
if (_lateUpdate != null) for (f in _lateUpdate) iron.App.removeLateUpdate(f);
}
public function resume() {
if (!paused) return;
paused = false;
if (_update != null) for (f in _update) iron.App.notifyOnUpdate(f);
if (_lateUpdate != null) for (f in _lateUpdate) iron.App.notifyOnLateUpdate(f);
}
}