-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbonus_effect.js
More file actions
40 lines (33 loc) · 1.14 KB
/
bonus_effect.js
File metadata and controls
40 lines (33 loc) · 1.14 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
pc.script.create('bonus_effect', function (context) {
var Bonus_effect = function (entity) {
this.entity = entity;
};
Bonus_effect.prototype = {
initialize: function () {
var game = context.root.findByName('Game').script.game;
game.on('pause', this.pause, this);
game.on('unpause', this.unpause, this);
this.scrollTextures = this.entity.getChildren().filter(function(child) {
return child.script && child.script.scroll_texture;
}).map(function (child) {
return child.script;
});
this.entity.setPosition(0, 0, 0);
},
pause: function () {
if (this.entity.enabled) {
this.scrollTextures.forEach(function (scroll) {
scroll.enabled = false;
});
}
},
unpause: function () {
if (this.entity.enabled) {
this.scrollTextures.forEach(function (scroll) {
scroll.enabled = true;
});
}
}
};
return Bonus_effect;
});