import { _decorator, AudioSource, Component } from 'cc';
import { GameEventEnum } from './GameStruct';
const { ccclass, property } = _decorator;

@ccclass('AudioManager')
export class AudioManager extends Component {
    onLoad() {
        window.gm.node.on(GameEventEnum.ReadyGo, () => {
            this.node.getChildByName("ready-go").getComponent(AudioSource).play();
        });
        window.gm.node.on(GameEventEnum.GameWin, () => {
            this.node.getChildByName("Cheers").getComponent(AudioSource).play();
        });
        window.gm.node.on(GameEventEnum.GameLose, () => {
            this.node.getChildByName("Boos").getComponent(AudioSource).play();
        });
    }
}


