const PlayerStateStatic = require('PlayerState'); cc.Class({ extends: cc.Component, properties: { // sprArray :{ // default:[], // type:[cc.Sprite], // }, }, start: function () { }, // onCollisionEnter: function (other) { // cc.log("现在加速",other.node.name+'Enter'); // if(other.node.name === 'PlayerCollisionLine') // { // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine"); // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState"); // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.AccelerationBandCenter; // PlayerStateScript.AccelerationBandCenterTouched = this; // // cc.log(PlayerStateScript.CurrentInZoneType ); // // } // // if(other.node.name === 'PlayerCollisionLine_ai') // { // console.log('相交 中 进'); // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine"); // var x =PlayerCollisionLine.Hero.x; // // cc.log("触碰点 中间 进",x); // var userData = { // name: 1, // p: x, // }; // this.getComponent("Ai_count").addData("ai",userData); // } // }, // onCollisionStay: function (other) { // // if(other.node.name === 'PlayerCollisionLine') // { // console.log('相交 中 出'); // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine"); // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState"); // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.AccelerationBandCenter; // PlayerStateScript.AccelerationBandCenterTouched = this; // // cc.log(PlayerStateScript.CurrentInZoneType ); // // } // }, // onCollisionExit: function (other) { // if(other.node.name === 'PlayerCollisionLine_ai') // { // // console.log('相交 中 出'); // } // } // 只在两个碰撞体开始接触时被调用一次 onBeginContact: function (contact, selfCollider, otherCollider) { // CustomLog("撞了",otherCollider); // CustomLog("刚体 棍子限制 碰撞 进入 ,",otherCollider.node.name); if(otherCollider.node.name === 'Hero') { var line = otherCollider.node.getChildByName("Player").getChildByName("PlayerCollisionLine"); var PlayerStateScript = otherCollider.getComponent("PlayerState"); PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.AccelerationBandCenter; PlayerStateScript.AccelerationBandCenterTouched = this; CustomLog("现在是 完美区域",PlayerStateScript.AccelerationBandCenterTouched); } }, // 只在两个碰撞体结束接触时被调用一次 onEndContact: function (contact, selfCollider, otherCollider) { }, // 每次将要处理碰撞体接触逻辑时被调用 onPreSolve: function (contact, selfCollider, otherCollider) { }, // 每次处理完碰撞体接触逻辑时被调用 onPostSolve: function (contact, selfCollider, otherCollider) { }, // update (dt) {}, });