cc.Class({ extends: cc.Component, properties: { Hero: { default: null, type: cc.Node, LevelIdex:0 }, }, start : function() { this.LevelIdex=0; this.GameStates = cc.find("Canvas").getComponent("GameStates"); }, onCollisionEnter: function (other) { // if(!bDebug)return; // // if(this.node.parent.parent.name == 'Hero') return; //获取场景 var scene = cc.director.getScene(); if (this.GameStates.isRobot) { cc.find("AIBot").getComponent("AIBot").Enters(other,this); } }, GetSyncObj:function(ParentName,ObjName,PositionX) { var Level = cc.find("Level"); var aX = parseFloat(PositionX); var Obj = null; var LevelChildren = Level.children; // cc.log('Level'+length); for(var i=0;iaX-1) { var Obj= this.GetSyncObj(CurrentCollider.ParentName,CurrentCollider.ObjName,CurrentCollider.BarrierPositionX); if (Obj==null) { return; } var ObjScript = Obj.getComponent('BarrierSuper'); if(CurrentCollider.State=='Enter') { ObjScript.onCollisionEnter(this); } else { ObjScript.onCollisionExit(this); } this.LevelIdex++; } } });