StartLine.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const GameStatesStatic = require('GameStates');
  2. var BarrierSuperClass = require("BarrierSuper");
  3. cc.Class({
  4. extends: BarrierSuperClass,
  5. properties: {
  6. NumOfCameIn:0,
  7. },
  8. onLoad: function () {
  9. },
  10. onCollisionEnter: function (other) {
  11. // return;
  12. if (other.node.name === 'PlayerCollisionLine')
  13. {
  14. if(this.NumOfCameIn == 0){
  15. this.NumOfCameIn++;
  16. this.ResetPerfectGradeAndAddScore(other);
  17. // cc.log("进了StartLine"+this.test);
  18. }
  19. // var CurrentPlayerNode = other.node.parent.parent;
  20. // var CurrentPlayerScript = CurrentPlayerNode.getComponent('HeroControl');
  21. // console.log("减速区域结束。");
  22. //停止减速
  23. // CurrentPlayerScript.ResetSpeed_noType_lerp_Stop();
  24. }
  25. },
  26. ResetPerfectGradeAndAddScore:function(other)//项目开始前重置perfectGrade,及显示比分
  27. {
  28. if (other.node.parent.parent.name == "Hero") {
  29. cc.find('Hero').getComponent('HeroControl').resetPerfectGrade();
  30. }
  31. var Level = cc.find('Level');
  32. Level.getComponent('LevelControl').hidePKScore(other.node.parent.parent);
  33. },
  34. GetOtherPlayer:function(CurrentPlayerNode)
  35. {
  36. var OtherPlayerNode = null;
  37. if (CurrentPlayerNode.name == 'Hero') {
  38. OtherPlayerNode = cc.find('Rivel');
  39. }
  40. else
  41. {
  42. OtherPlayerNode = cc.find('Hero');
  43. }
  44. return OtherPlayerNode;
  45. },
  46. });