AccelerationBandCenter.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. const PlayerStateStatic = require('PlayerState');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. // sprArray :{
  6. // default:[],
  7. // type:[cc.Sprite],
  8. // },
  9. },
  10. start: function () {
  11. },
  12. // onCollisionEnter: function (other) {
  13. // cc.log("现在加速",other.node.name+'Enter');
  14. // if(other.node.name === 'PlayerCollisionLine')
  15. // {
  16. // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  17. // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
  18. // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.AccelerationBandCenter;
  19. // PlayerStateScript.AccelerationBandCenterTouched = this;
  20. // // cc.log(PlayerStateScript.CurrentInZoneType );
  21. //
  22. // }
  23. //
  24. // if(other.node.name === 'PlayerCollisionLine_ai')
  25. // {
  26. // console.log('相交 中 进');
  27. // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  28. // var x =PlayerCollisionLine.Hero.x;
  29. // // cc.log("触碰点 中间 进",x);
  30. // var userData = {
  31. // name: 1,
  32. // p: x,
  33. // };
  34. // this.getComponent("Ai_count").addData("ai",userData);
  35. // }
  36. // },
  37. // onCollisionStay: function (other) {
  38. //
  39. // if(other.node.name === 'PlayerCollisionLine')
  40. // {
  41. // console.log('相交 中 出');
  42. // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  43. // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
  44. // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.AccelerationBandCenter;
  45. // PlayerStateScript.AccelerationBandCenterTouched = this;
  46. // // cc.log(PlayerStateScript.CurrentInZoneType );
  47. //
  48. // }
  49. // },
  50. // onCollisionExit: function (other) {
  51. // if(other.node.name === 'PlayerCollisionLine_ai')
  52. // {
  53. // // console.log('相交 中 出');
  54. // }
  55. // }
  56. // 只在两个碰撞体开始接触时被调用一次
  57. onBeginContact: function (contact, selfCollider, otherCollider) {
  58. // CustomLog("撞了",otherCollider);
  59. // CustomLog("刚体 棍子限制 碰撞 进入 ,",otherCollider.node.name);
  60. if(otherCollider.node.name === 'Hero')
  61. {
  62. var line = otherCollider.node.getChildByName("Player").getChildByName("PlayerCollisionLine");
  63. var PlayerStateScript = otherCollider.getComponent("PlayerState");
  64. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.AccelerationBandCenter;
  65. PlayerStateScript.AccelerationBandCenterTouched = this;
  66. CustomLog("现在是 完美区域",PlayerStateScript.AccelerationBandCenterTouched);
  67. }
  68. },
  69. // 只在两个碰撞体结束接触时被调用一次
  70. onEndContact: function (contact, selfCollider, otherCollider) {
  71. },
  72. // 每次将要处理碰撞体接触逻辑时被调用
  73. onPreSolve: function (contact, selfCollider, otherCollider) {
  74. },
  75. // 每次处理完碰撞体接触逻辑时被调用
  76. onPostSolve: function (contact, selfCollider, otherCollider) {
  77. },
  78. // update (dt) {},
  79. });