const PlayerStateStatic = require('PlayerState'); const ai = require('Ai_count'); cc.Class({ extends: cc.Component, properties: { }, start: function () { }, // 只在两个碰撞体开始接触时被调用一次 onBeginContact: function (contact, selfCollider, otherCollider) { CustomLog("进入,","自己",selfCollider.node.name,"其他",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.FrontAccelerationBand; // cc.log("触碰点 左面 进",x); // cc.log("触碰点",PlayerStateScript.CurrentInZoneType ); } }, // 只在两个碰撞体结束接触时被调用一次 onEndContact: function (contact, selfCollider, otherCollider) { }, // 每次将要处理碰撞体接触逻辑时被调用 onPreSolve: function (contact, selfCollider, otherCollider) { }, // 每次处理完碰撞体接触逻辑时被调用 onPostSolve: function (contact, selfCollider, otherCollider) { }, // onCollisionEnter: function (other) { // if(other.node.name === 'PlayerCollisionLine') // { // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine"); // // cc.log("触碰点 左面 进",PlayerCollisionLine); // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState"); // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.FrontAccelerationBand; // // cc.log("触碰点 左面 进",x); // // cc.log(PlayerStateScript.CurrentInZoneType ); // } // // if(other.node.name === 'PlayerCollisionLine_ai') // { // console.log('相交 左 进'); // // cc.log("触碰点 左面 进",other); // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine"); // var x =PlayerCollisionLine.Hero.x; // var userData = { // name: 0, // p: x, // }; // this.getComponent("Ai_count").addData("ai",userData); // } // // }, // onCollisionStay: function (other) { // // if(other.node.name === 'PlayerCollisionLine_ai') // { // // console.log('相交 左 中'); // } // }, // onCollisionExit: function (other) { // if(other.node.name === 'PlayerCollisionLine_ai') // { // // console.log('相交 左 出'); // } // } });