-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmitEventActionScript.js
More file actions
executable file
·79 lines (51 loc) · 1.25 KB
/
Copy pathEmitEventActionScript.js
File metadata and controls
executable file
·79 lines (51 loc) · 1.25 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// You can write more code here
/* START OF COMPILED CODE */
class EmitEventActionScript extends ScriptNode {
constructor(parent) {
super(parent);
/* START-USER-CTR-CODE */
// Write your code here.
/* END-USER-CTR-CODE */
}
/** @type {string} */
eventName = "";
/** @type {"game.events"|"scene.events"|"scene.loader"|"scene.input"|"scene.input.keyboard"|"scene.anims"|"gameObject"} */
eventEmitter = "gameObject";
/* START-USER-CODE */
/**
* @param {...any} args
*/
execute(...args) {
/** @type {Phaser.Events.EventEmitter | null | undefined} */
let emitter;
switch (this.eventEmitter) {
case "game.events":
emitter = this.scene.game.events;
break;
case "scene.events":
emitter = this.scene.events;
break;
case "scene.loader":
emitter = this.scene.load;
break;
case "scene.input":
emitter = this.scene.input;
break;
case "scene.input.keyboard":
emitter = this.scene.input.keyboard;
break;
case "scene.anims":
emitter = this.scene.anims;
break;
case "gameObject":
emitter = this.gameObject;
break;
}
if (emitter) {
emitter.emit(this.eventName, ...args);
}
}
/* END-USER-CODE */
}
/* END OF COMPILED CODE */
// You can write more code here