2dd29f6f0dc368717750ce3e35e380dd6850c615.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, AnimatorTransition, AnimatorState, _crd;
  4. function _reportPossibleCrUseOfAnimatorController(extras) {
  5. _reporterNs.report("AnimatorController", "./AnimatorController", _context.meta, extras);
  6. }
  7. function _reportPossibleCrUseOfAnimatorTransition(extras) {
  8. _reporterNs.report("AnimatorTransition", "./AnimatorTransition", _context.meta, extras);
  9. }
  10. _export("default", void 0);
  11. return {
  12. setters: [function (_unresolved_) {
  13. _reporterNs = _unresolved_;
  14. }, function (_cc) {
  15. _cclegacy = _cc.cclegacy;
  16. }, function (_unresolved_2) {
  17. AnimatorTransition = _unresolved_2.default;
  18. }],
  19. execute: function () {
  20. _crd = true;
  21. _cclegacy._RF.push({}, "bd2d1/E71JL1Jj3HzsYH82H", "AnimatorState", undefined);
  22. /**
  23. * 状态管理类
  24. */
  25. _export("default", AnimatorState = class AnimatorState {
  26. /** 状态名 */
  27. get name() {
  28. return this._name;
  29. }
  30. /** 动画名 */
  31. get motion() {
  32. return this._motion;
  33. }
  34. /** 动画是否循环播放 */
  35. get loop() {
  36. return this._loop;
  37. }
  38. /** 动画播放速度的混合参数 */
  39. get multi() {
  40. return this._multi;
  41. }
  42. /** 动画播放速度 */
  43. get speed() {
  44. return this._speed;
  45. }
  46. set speed(value) {
  47. this._speed = value;
  48. }
  49. constructor(data, ac) {
  50. this._name = "";
  51. this._motion = "";
  52. this._loop = false;
  53. this._speed = 1;
  54. this._multi = "";
  55. this._transitions = [];
  56. this._ac = null;
  57. this._name = data.state;
  58. this._motion = data.motion || '';
  59. this._loop = data.loop || false;
  60. this._speed = data.speed || 1;
  61. this._multi = data.multiplier || '';
  62. this._ac = ac;
  63. for (let i = 0; i < data.transitions.length; i++) {
  64. let transition = new (_crd && AnimatorTransition === void 0 ? (_reportPossibleCrUseOfAnimatorTransition({
  65. error: Error()
  66. }), AnimatorTransition) : AnimatorTransition)(data.transitions[i], ac);
  67. transition.isValid() && this._transitions.push(transition);
  68. }
  69. }
  70. /**
  71. * 判断各个分支是否满足条件,满足则转换状态
  72. */
  73. checkAndTrans() {
  74. for (let i = 0; i < this._transitions.length; i++) {
  75. let transition = this._transitions[i];
  76. if (transition && transition.check()) {
  77. transition.doTrans();
  78. return;
  79. }
  80. }
  81. }
  82. });
  83. _cclegacy._RF.pop();
  84. _crd = false;
  85. }
  86. };
  87. });
  88. //# sourceMappingURL=2dd29f6f0dc368717750ce3e35e380dd6850c615.js.map