wgge 2.0.26 → 2.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,7 +26,7 @@ export default class ControllerBase extends ActivatedTreeNode {
|
|
|
26
26
|
this.game = game;
|
|
27
27
|
this.model = model;
|
|
28
28
|
|
|
29
|
-
this.updateActions =
|
|
29
|
+
this.updateActions = [];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
update(delta) {
|
|
@@ -34,16 +34,23 @@ export default class ControllerBase extends ActivatedTreeNode {
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (this.updateActions) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
action(delta);
|
|
41
|
-
}
|
|
42
|
-
this.updateActions = null;
|
|
37
|
+
if (this.updateActions.length > 0) {
|
|
38
|
+
this.updateActions.forEach((action) => action(delta));
|
|
39
|
+
this.updateActions = [];
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
this.updateInternal(delta);
|
|
46
|
-
|
|
43
|
+
|
|
44
|
+
if (this.children.length > 0) {
|
|
45
|
+
// this make sure all children are updated even if some of them are removed during processing
|
|
46
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
47
|
+
this.updateActions.push(() => this.children[i].update(delta));
|
|
48
|
+
}
|
|
49
|
+
for (let i = 0, max = this.updateActions.length; i < max; i++) {
|
|
50
|
+
this.updateActions[i]();
|
|
51
|
+
}
|
|
52
|
+
this.updateActions = [];
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
updateInternal(delta) {
|
|
@@ -55,9 +62,6 @@ export default class ControllerBase extends ActivatedTreeNode {
|
|
|
55
62
|
* @param action (delta) => any
|
|
56
63
|
*/
|
|
57
64
|
runOnUpdate(action) {
|
|
58
|
-
if (!this.updateActions) {
|
|
59
|
-
this.updateActions = [];
|
|
60
|
-
}
|
|
61
65
|
this.updateActions.push(action);
|
|
62
66
|
}
|
|
63
67
|
|