// 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

const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property({ type: [cc.Node], displayName: "交替组" })
    public labaList: cc.Node[] = []
    private current: number;
    onLoad() {
        this.current = 0;
        this.schedule(this.onUpdate, 0.3);
    }
    onUpdate() {
        this.current++;
        if (this.current > this.labaList.length - 1) this.current = 0;
        this.labaList.forEach((laba, i) => {
            laba.active = i == this.current;
        })
    }
    // update (dt) {}
}
