e5950fcbef545fc8bd7782af571dd62528d330a2.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Component, Node, Vec3, _decorator, Vec3Util, _dec, _class, _crd, ccclass, property, MoveTranslate;
  4. function _reportPossibleCrUseOfVec3Util(extras) {
  5. _reporterNs.report("Vec3Util", "../../core/utils/Vec3Util", _context.meta, extras);
  6. }
  7. return {
  8. setters: [function (_unresolved_) {
  9. _reporterNs = _unresolved_;
  10. }, function (_cc) {
  11. _cclegacy = _cc.cclegacy;
  12. __checkObsolete__ = _cc.__checkObsolete__;
  13. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  14. Component = _cc.Component;
  15. Node = _cc.Node;
  16. Vec3 = _cc.Vec3;
  17. _decorator = _cc._decorator;
  18. }, function (_unresolved_2) {
  19. Vec3Util = _unresolved_2.Vec3Util;
  20. }],
  21. execute: function () {
  22. _crd = true;
  23. _cclegacy._RF.push({}, "e626612zClLO4OZDEWvT+fr", "MoveTranslate", undefined);
  24. /*
  25. * @Author: dgflash
  26. * @Date: 2022-03-25 18:12:10
  27. * @LastEditors: dgflash
  28. * @LastEditTime: 2022-07-25 11:52:23
  29. */
  30. __checkObsolete__(['Component', 'Node', 'Vec3', '_decorator']);
  31. ({
  32. ccclass,
  33. property
  34. } = _decorator);
  35. /** 角色坐标方式移动 */
  36. _export("MoveTranslate", MoveTranslate = (_dec = ccclass('MoveTranslate'), _dec(_class = class MoveTranslate extends Component {
  37. constructor(...args) {
  38. super(...args);
  39. /** 移动方向 */
  40. this.velocity = (_crd && Vec3Util === void 0 ? (_reportPossibleCrUseOfVec3Util({
  41. error: Error()
  42. }), Vec3Util) : Vec3Util).zero;
  43. /** 移动速度 */
  44. this.speed = 0;
  45. this.vector = new Vec3();
  46. }
  47. update(dt) {
  48. if (this.speed > 0) {
  49. Vec3.multiplyScalar(this.vector, this.velocity, this.speed * dt);
  50. this.node.translate(this.vector, Node.NodeSpace.WORLD);
  51. }
  52. }
  53. }) || _class));
  54. _cclegacy._RF.pop();
  55. _crd = false;
  56. }
  57. };
  58. });
  59. //# sourceMappingURL=e5950fcbef545fc8bd7782af571dd62528d330a2.js.map