//三个节点发射运动

cc.Class({
    extends: cc.Component,

    properties: {
        feibiao1: cc.Node,
        feibiao2: cc.Node,
        feibiao3: cc.Node,
        knife: cc.Node,   //一把飞镖节点
        knifeNum: cc.Node, //三把飞镖节点
        threeDartBtn: cc.Node, //三镖齐发按钮
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
        this.onDaiji();
    },

    onDaiji: function(){
        this.node.runAction(cc.repeatForever(
            cc.sequence(
                cc.moveBy(0.4, 0, 40),
                cc.moveBy(0.4, 0, -40),
            )
        ));    
    },

    onLauch() {
        let cdFunc1 = cc.callFunc(()=>{
            // cc.HQ.GameMgr.isInitGame =true;
            this.feibiao1.setPosition(0,0);
            this.feibiao1.rotation =0;
            if(!cc.HQ.Local.experWeapons){   //若不是体验关卡时，
                //三飞镖齐飞数量显示
                this.onSanKnifeShow();
            }
        },this);

        let cdFunc11 = cc.callFunc(()=>{
            cc.HQ.GameMgr.isInitGame =true;    
        },this)

        let cdFunc2 = cc.callFunc(()=>{
            // cc.HQ.GameMgr.isInitGame =true;
            this.feibiao2.setPosition(48,-19);
            this.feibiao2.rotation =35;
            if(!cc.HQ.Local.experWeapons){   //若不是体验关卡时，
                //三飞镖齐飞数量显示
                this.onSanKnifeShow();
            }
        },this);

        let cdFunc22 = cc.callFunc(()=>{
            cc.HQ.GameMgr.isInitGame =true;    
        },this)

        let cdFunc3 = cc.callFunc(()=>{
            // cc.HQ.GameMgr.isInitGame =true;
            this.feibiao3.setPosition(-48,-19);
            this.feibiao3.rotation =-35;
            if(!cc.HQ.Local.experWeapons){   //若不是体验关卡时，
                //三飞镖齐飞数量显示
                this.onSanKnifeShow();
            }
        },this);

        let cdFunc33 = cc.callFunc(()=>{
            cc.HQ.GameMgr.isInitGame =true;    
        },this)

        this.feibiao1.runAction(cc.sequence(
            cc.spawn(
            cc.moveBy(0.4, 0, 1100),
            cc.rotateBy(0.4, 720)
        ),
        cdFunc1,
        cc.delayTime(0.1),
        cdFunc11
        ));
        this.feibiao2.runAction(cc.sequence(
            cc.spawn(
            cc.moveBy(0.4, 0, 1100),
            cc.moveBy(0.2, 80, 0),
            cc.rotateBy(0.4, 720)
        ),cdFunc2,
        cc.delayTime(0.1),
        cdFunc22
        ));
        this.feibiao3.runAction(cc.sequence(
            cc.spawn(
            cc.moveBy(0.4, 0, 1100),
            cc.moveBy(0.2, -80, 0),
            cc.rotateBy(0.4, 720)
        ),cdFunc3,
        cc.delayTime(0.1),
        cdFunc33
        ));   
    },

    //三飞镖数量显示
    onSanKnifeShow: function(){
        if(cc.HQ.Local.weaponClones && cc.HQ.Local.weaponClones>0){
            this.knife.active =false;
            this.knifeNum.active =true;
        }else{
            if(!this.knife.active){
                this.knife.active =true;
                this.knifeNum.active =false;
                this.threeDartBtn.active =true;  //三镖齐发按钮显示
            }
        }
    },


    // update (dt) {},
});
