BehindAccelerationBand.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. // console.log('Stagger == ',PlayerStateScript.BTouchedScreenInTheZone);
  38. if(!PlayerStateScript.BTouchedScreenInTheZone)
  39. {
  40. HeroControlScript.Stagger();
  41. // console.log('Stagger!!');
  42. }
  43. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.None;
  44. PlayerStateScript.BTouchedScreenInTheZone = false;
  45. }
  46. if(other.node.name === 'PlayerCollisionLine_ai')
  47. {
  48. // cc.log(PlayerStateScript.CurrentInZoneType );
  49. }
  50. },
  51. });