BehindAccelerationBand.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const PlayerStateStatic = require('PlayerState');
  2. var BarrierSuperClass = require("BarrierSuper");
  3. cc.Class({
  4. extends: BarrierSuperClass,
  5. properties: {
  6. },
  7. onCollisionEnter: function (other) {
  8. if(other.node.name === 'PlayerCollisionLine')
  9. {
  10. var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  11. var PlayerStateScript = PlayerCollisionLine.node.parent.parent.getComponent("PlayerState");
  12. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.BehindAccelerationBand;
  13. // cc.log(PlayerStateScript.CurrentInZoneType );
  14. }
  15. if(other.node.name === 'PlayerCollisionLine_ai')
  16. {
  17. // cc.log(PlayerStateScript.CurrentInZoneType );
  18. }
  19. },
  20. onCollisionStay: function (other) {
  21. // console.log('on collision stay');
  22. },
  23. onCollisionExit: function (other) {
  24. if(other.node.name === 'PlayerCollisionLine')
  25. {
  26. var PlayerState = other.node.parent.parent.getComponent("PlayerState");
  27. PlayerState.TouchControlEnableTouch = true;
  28. // if (other.node.parent.parent.name == "Hero") {
  29. // var PlayerState = other.node.parent.parent.getComponent("PlayerState");
  30. // PlayerState.TouchControlEnableTouch = true;
  31. // // cc.log("状态 可以点击");
  32. // }
  33. // cc.log("我出去了吗",other.node.name);
  34. var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  35. var HeroControlScript = PlayerCollisionLine.node.parent.parent.getComponent("HeroControl");
  36. var PlayerStateScript = PlayerCollisionLine.node.parent.parent.getComponent("PlayerState");
  37. if(!PlayerStateScript.BTouchedScreenInTheZone)
  38. {
  39. HeroControlScript.Stagger();
  40. }
  41. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.None;
  42. PlayerStateScript.BTouchedScreenInTheZone = false;
  43. }
  44. if(other.node.name === 'PlayerCollisionLine_ai')
  45. {
  46. // cc.log(PlayerStateScript.CurrentInZoneType );
  47. }
  48. },
  49. });