const GameStatesStatic = require('GameStates');
var BarrierSuperClass = require("BarrierSuper");
cc.Class({
    extends: BarrierSuperClass,

    properties: {
        tag : false,
        isSyncPosition:false,//跳远和扔标签部分共用的同步位置
    },
    onLoad : function () {
        // this.tag = true;
    },
    onCollisionEnter: function (other)
    {
        if(other.node.name === 'PlayerCollisionLine')
        {
            // var TouchLayout = cc.find("TouchLayout");
            // var NodeTouch = TouchLayout.getComponent("NodeTouch");
            var PlayerState = other.node.parent.parent.getComponent("PlayerState");
            PlayerState.TouchControlEnableTouch = this.tag;
            PlayerState.enableTouch = this.tag;


            // cc.log("撞我了 ?",other.node.parent.parent.name,PlayerState.TouchControlEnableTouch);

            if(this.isSyncPosition){
                // console.log("进入跳远后同步下位置", other.node.parent.name);
                var data = { FunctionName: "SetRivelPosition", "positionX": other.node.parent.parent.position.x };
                cc.find('Canvas').getComponent('GameMode').SynchronizationFun(data);
            }
        }

    },
    onCollisionStay: function (other) {
        // console.log('on collision stay');
    },
    onCollisionExit: function (other) {

    },
    CollisionEnter: function (other)
    {
        // cc.log("撞我了 ?")
        if(other.node.name === 'PlayerCollisionLine')
        {
            // var TouchLayout = cc.find("TouchLayout");
            // var NodeTouch = TouchLayout.getComponent("NodeTouch");
            var PlayerState = other.node.parent.parent.getComponent("PlayerState");
            PlayerState.TouchControlEnableTouch = this.tag;


            // cc.log("撞我了 ?",other.node.parent.parent.name,PlayerState.TouchControlEnableTouch);
        }

    }
});
