mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-27 12:08:21 +00:00
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
|
|
properties: {
|
|
BGMEffect: {
|
|
type: cc.AudioClip,
|
|
default: null
|
|
},
|
|
crashedByTrapBullet: {
|
|
type: cc.AudioClip,
|
|
default: null
|
|
},
|
|
highScoreTreasurePicked: {
|
|
type: cc.AudioClip,
|
|
default: null
|
|
},
|
|
treasurePicked: {
|
|
type: cc.AudioClip,
|
|
default: null
|
|
},
|
|
countDown10SecToEnd: {
|
|
type: cc.AudioClip,
|
|
default: null
|
|
},
|
|
mapNode: {
|
|
type: cc.Node,
|
|
default: null
|
|
},
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
onLoad() {
|
|
cc.audioEngine.setEffectsVolume(1);
|
|
cc.audioEngine.setMusicVolume(0.5);
|
|
},
|
|
stopAllMusic() {
|
|
cc.audioEngine.stopAll();
|
|
},
|
|
playBGM() {
|
|
if(this.BGMEffect) {
|
|
cc.audioEngine.playMusic(this.BGMEffect, true);
|
|
}
|
|
},
|
|
playCrashedByTrapBullet() {
|
|
if(this.crashedByTrapBullet) {
|
|
cc.audioEngine.playEffect(this.crashedByTrapBullet, false);
|
|
}
|
|
},
|
|
playHighScoreTreasurePicked() {
|
|
if(this.highScoreTreasurePicked) {
|
|
cc.audioEngine.playEffect(this.highScoreTreasurePicked, false);
|
|
}
|
|
},
|
|
playTreasurePicked() {
|
|
if(this.treasurePicked) {
|
|
cc.audioEngine.playEffect(this.treasurePicked, false);
|
|
}
|
|
},
|
|
playCountDown10SecToEnd() {
|
|
if(this.countDown10SecToEnd) {
|
|
cc.audioEngine.playEffect(this.countDown10SecToEnd, false);
|
|
}
|
|
},
|
|
});
|
|
|