| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- const PlayerStateStatic = require('PlayerState');
- var BarrierSuperClass = require("BarrierSuper");
- cc.Class({
- extends: BarrierSuperClass,
- properties: {
- },
- onCollisionEnter: function (other) {
- if(other.node.name === 'PlayerCollisionLine')
- {
- var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
- var PlayerStateScript = PlayerCollisionLine.node.parent.parent.getComponent("PlayerState");
- PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.BehindAccelerationBand;
- // cc.log(PlayerStateScript.CurrentInZoneType );
- }
- if(other.node.name === 'PlayerCollisionLine_ai')
- {
- // cc.log(PlayerStateScript.CurrentInZoneType );
- }
- },
- onCollisionStay: function (other) {
- // console.log('on collision stay');
- },
- onCollisionExit: function (other) {
- if(other.node.name === 'PlayerCollisionLine')
- {
- var PlayerState = other.node.parent.parent.getComponent("PlayerState");
- PlayerState.TouchControlEnableTouch = true;
- // if (other.node.parent.parent.name == "Hero") {
- // var PlayerState = other.node.parent.parent.getComponent("PlayerState");
- // PlayerState.TouchControlEnableTouch = true;
- // // cc.log("状态 可以点击");
- // }
- // cc.log("我出去了吗",other.node.name);
- var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
- var HeroControlScript = PlayerCollisionLine.node.parent.parent.getComponent("HeroControl");
- var PlayerStateScript = PlayerCollisionLine.node.parent.parent.getComponent("PlayerState");
- if(!PlayerStateScript.BTouchedScreenInTheZone)
- {
- HeroControlScript.Stagger();
- }
- PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.None;
- PlayerStateScript.BTouchedScreenInTheZone = false;
- }
- if(other.node.name === 'PlayerCollisionLine_ai')
- {
- // cc.log(PlayerStateScript.CurrentInZoneType );
- }
- },
- });
|