PlaySoundEffectOnEnabled.ts
514 Bytes
import { AudioSettings } from "simba-cc-audio-manager";
const { ccclass, property } = cc._decorator;
@ccclass
export default class PlaySoundEffectOnEnabled extends cc.Component {
@property({ type: cc.AudioClip })
clip: cc.AudioClip = null as any as cc.AudioClip;
onLoad() { }
start() {
}
onEnable() {
if (this.clip && AudioSettings.soundVolume != 0) {
cc.audioEngine.playEffect(this.clip, false);
}
}
onDisable() {
}
update(dt) { }
}