BasePlayerStates.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. var BasePlayerConfig = require("./BasePlayerConfig");
  2. var playerConfig = new BasePlayerConfig();
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. bMain: {
  7. default: false,
  8. },
  9. },
  10. onLoad() {
  11. this.init();
  12. },
  13. init()
  14. {
  15. this.playerAnimState = {
  16. default: 0,
  17. idle: 1,
  18. run: 2,
  19. jump: 3,
  20. stagger:4,
  21. };
  22. //playerProgressStates
  23. this.pProStates = {
  24. default: 0,
  25. gaming: 1,
  26. intoEnd: 2,
  27. end: 3,
  28. };
  29. //currentProgressState
  30. this.currentProState = this.pProStates.default;
  31. this.currentState = this.playerAnimState.idle;
  32. this.currentSpeed = playerConfig.playerSpeedGrade.idle;
  33. this.futureSpeed = playerConfig.playerSpeedGrade.idle;
  34. this.lastSpeed = playerConfig.playerSpeedGrade.idle;
  35. this.targetMovePos = 0;
  36. this.restMovePos = 0;
  37. //next change map target position x
  38. this.targetPoint = 360;
  39. //SpeedGrade for change running state animation
  40. this.currentSpeedGrade = playerConfig.playerSpeedGrade.idle;
  41. this.passedHurdrailNum = 0;
  42. this.handrailArr = [];
  43. this.currentHandrailIndex = 0;
  44. this.drawedhandrailArr = [];
  45. this.nextHandrail = null;
  46. this.actionArr = [];
  47. //跳跃在空中的时间
  48. this.jumpDuration = 1;
  49. }
  50. });