cc.Class({ extends: cc.Component, properties: { }, start () { }, // onCollisionEnter: function (other) // { // if(other.node.name === 'PlayerCollisionLine') // { // var Level = this.node.parent.parent; // var Canvas = Level.getComponent('LevelControl').Canvas; // var GameStates = Canvas.getComponent('GameStates'); // // // other.node.parent.getComponent('HeroControl').EnableHeroMoving(false); // // other.node.parent.getComponent('HeroControl').SetCurrentSpeed(0); // other.node.parent.parent.getComponent('HeroControl').PlayerStateScript .CurrentSpeed = 0; // // other.node.parent.getComponent('HeroControl').ResetSpeed(); // //获取场景 // var scene = cc.director.getScene(); // // cc.log("父亲",scene); // var charactor = scene.getChildByName("Hero").getChildByName("Player").getComponent("Charactor"); // // cc.log("有么",charactor); // if (charactor != null) { // charactor.idle(); // var Canvas = cc.find("Canvas"); // Canvas.getComponent("NodeTouch").enableTouch = false; // } // } // }, // onCollisionStay: function (other) { // // console.log('on collision stay'); // }, // onCollisionExit: function (other) { // // }, onBeginContact: function (contact, selfCollider, otherCollider) { // CustomLog("撞了",otherCollider); // CustomLog("刚体 棍子限制 碰撞 进入 ,",otherCollider.node.name); if(otherCollider.node.name === 'Hero') { var Canvas = cc.find("Canvas"); var GameStates = Canvas.getComponent('GameStates'); // other.node.parent.getComponent('HeroControl').EnableHeroMoving(false); // other.node.parent.getComponent('HeroControl').SetCurrentSpeed(0); otherCollider.getComponent('HeroControl').PlayerStateScript .CurrentSpeed = 0; // other.node.parent.getComponent('HeroControl').ResetSpeed(); //获取场景 var scene = cc.director.getScene(); // cc.log("父亲",scene); var charactor = scene.getChildByName("Hero").getChildByName("Player").getComponent("Charactor"); // cc.log("有么",charactor); if (charactor != null) { charactor.idle(); var Canvas = cc.find("Canvas"); Canvas.getComponent("NodeTouch").enableTouch = false; } } }, // 只在两个碰撞体结束接触时被调用一次 onEndContact: function (contact, selfCollider, otherCollider) { }, // 每次将要处理碰撞体接触逻辑时被调用 onPreSolve: function (contact, selfCollider, otherCollider) { }, // 每次处理完碰撞体接触逻辑时被调用 onPostSolve: function (contact, selfCollider, otherCollider) { }, });