PreHurdleBand.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const PlayerStateStatic = require('PlayerState');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. Barrier: {
  6. default: null,
  7. type: cc.Node
  8. },
  9. },
  10. start () {
  11. },
  12. // onCollisionEnter: function (other) {
  13. // if(other.node.name === 'PlayerCollisionLine')
  14. // {
  15. // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  16. // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
  17. // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.PreHurdleBand;
  18. //
  19. // PlayerStateScript.Barrier = this.Barrier;
  20. // // cc.log(PlayerStateScript.CurrentInZoneType );
  21. //
  22. // }
  23. // },
  24. // onCollisionStay: function (other) {
  25. // // console.log('on collision stay');
  26. // },
  27. // onCollisionExit: function (other) {
  28. //
  29. // },
  30. //
  31. // 只在两个碰撞体开始接触时被调用一次
  32. onBeginContact: function (contact, selfCollider, otherCollider) {
  33. CustomLog("撞了 跨栏",otherCollider);
  34. if(otherCollider.node.name === 'Hero')
  35. {
  36. CustomLog("刚体 跨栏 一般 ,",otherCollider.node.name);
  37. var PlayerStateScript = otherCollider.getComponent("PlayerState");
  38. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.PreHurdleBand;
  39. PlayerStateScript.Barrier = this.Barrier;
  40. }
  41. },
  42. // 只在两个碰撞体结束接触时被调用一次
  43. onEndContact: function (contact, selfCollider, otherCollider) {
  44. },
  45. // 每次将要处理碰撞体接触逻辑时被调用
  46. onPreSolve: function (contact, selfCollider, otherCollider) {
  47. },
  48. // 每次处理完碰撞体接触逻辑时被调用
  49. onPostSolve: function (contact, selfCollider, otherCollider) {
  50. },
  51. });