// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import { myAudioManager } from "./AudioManger";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {


    start () {
        myAudioManager.playMusic('bg');
        this.timecount(60);
    }

    public timecount(n){
        cc.tween(this.node)
            .delay(1)
            .call(()=>{
                n--;
                console.log(n);
                cc.find('Canvas/Label').getComponent(cc.Label).string = n;
                this.timecount(n)
            })
            .start()
    }
    // update (dt) {}
}
