PerfectLongJumpBand.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const PlayerStateStatic = require('PlayerState');
  2. var BarrierSuperClass = require("BarrierSuper");
  3. cc.Class({
  4. extends:BarrierSuperClass,
  5. properties: {
  6. },
  7. start () {
  8. },
  9. onCollisionEnter: function (other) {
  10. if(other.node.name === 'PlayerCollisionLine')
  11. {
  12. var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  13. var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
  14. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.PerfectLongJumpBand;
  15. PlayerStateScript.PerfectLongJumpBandCenterTouched = this;
  16. // cc.log(PlayerStateScript.CurrentInZoneType );
  17. }
  18. if(other.node.name === 'LocationLine')
  19. {
  20. //perfect完美提示
  21. cc.find('UIControl').getComponent('GameUI').hideTimerPerfect(3);
  22. cc.find('Hero').getComponent('HeroControl').addPerfectGradeAndPlay();
  23. this.node.destroy();
  24. }
  25. },
  26. onCollisionStay: function (other) {
  27. // console.log('on collision stay');
  28. },
  29. onCollisionExit: function (other)
  30. {
  31. if(other.node.name === 'PlayerCollisionLine') {
  32. var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
  33. var HeroControlScript = PlayerCollisionLine.Hero.getComponent("HeroControl");
  34. var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
  35. if(!PlayerStateScript.BTouchedScreenInTheZone)
  36. {
  37. HeroControlScript.Stagger();
  38. }
  39. PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.None;
  40. PlayerStateScript.BTouchedScreenInTheZone = false;
  41. }
  42. }
  43. });