HurdleEnd.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. },
  5. start () {
  6. },
  7. // onCollisionEnter: function (other)
  8. // {
  9. // if(other.node.name === 'PlayerCollisionLine')
  10. // {
  11. // var Level = this.node.parent.parent;
  12. // var Canvas = Level.getComponent('LevelControl').Canvas;
  13. // var GameStates = Canvas.getComponent('GameStates');
  14. //
  15. // other.node.parent.parent.getComponent('HeroControl').ResetSpeed();
  16. // }
  17. // },
  18. //
  19. // onCollisionStay: function (other) {
  20. // // console.log('on collision stay');
  21. // },
  22. // onCollisionExit: function (other) {
  23. //
  24. // },
  25. onBeginContact: function (contact, selfCollider, otherCollider) {
  26. // CustomLog("撞了",otherCollider);
  27. // CustomLog("刚体 棍子限制 碰撞 进入 ,",otherCollider.node.name);
  28. if(otherCollider.node.name === 'Hero')
  29. {
  30. var Canvas = cc.find("Canvas");
  31. var GameStates = Canvas.getComponent('GameStates');
  32. otherCollider.getComponent('HeroControl').ResetSpeed();
  33. }
  34. },
  35. // 只在两个碰撞体结束接触时被调用一次
  36. onEndContact: function (contact, selfCollider, otherCollider) {
  37. },
  38. // 每次将要处理碰撞体接触逻辑时被调用
  39. onPreSolve: function (contact, selfCollider, otherCollider) {
  40. },
  41. // 每次处理完碰撞体接触逻辑时被调用
  42. onPostSolve: function (contact, selfCollider, otherCollider) {
  43. },
  44. });