PreHurdleBand.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const PlayerStateStatic = require('PlayerState');
  2. var BarrierSuperClass = require("BarrierSuper");
  3. cc.Class({
  4. extends:BarrierSuperClass,
  5. properties: {
  6. Barrier: {
  7. default: null,
  8. type: cc.Node
  9. },
  10. Railing: {
  11. default: null,
  12. type: cc.Node
  13. },
  14. },
  15. start () {
  16. },
  17. onCollisionEnter: function (other) {
  18. if(other.node.name === 'PlayerCollisionLine')
  19. {
  20. // var PlayerState = other.node.parent.parent.getComponent("PlayerState");
  21. // PlayerState.TouchControlEnableTouch = true;
  22. var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  23. var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
  24. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.PreHurdleBand;
  25. // if (other.node.parent.parent.name == "Hero") {
  26. PlayerStateScript.Barrier = this.Barrier;
  27. // }
  28. // if (other.node.parent.parent.name == "Rivel") {
  29. PlayerStateScript.Railing = this.Railing;
  30. // }
  31. // cc.log(PlayerStateScript.CurrentInZoneType );
  32. }
  33. },
  34. onCollisionStay: function (other) {
  35. // console.log('on collision stay');
  36. },
  37. onCollisionExit: function (other) {
  38. }
  39. });