4f27b005-95d6-4b24-b6e3-a84602fbed58.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. "use strict";
  2. cc._RF.push(module, '4f27bAFldZLJLbjqEYC++1Y', 'Rotate');
  3. // Script/new_20210323/Rotate.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  26. var NewClass = /** @class */ (function (_super) {
  27. __extends(NewClass, _super);
  28. function NewClass() {
  29. var _this = _super !== null && _super.apply(this, arguments) || this;
  30. _this.speed = 1;
  31. _this.isRotate = true;
  32. _this.isChangeDir = false;
  33. _this.isChangeRotateDir = false;
  34. return _this;
  35. }
  36. // LIFE-CYCLE CALLBACKS:
  37. // onLoad () {}
  38. NewClass.prototype.start = function () {
  39. if ((this.isChangeDir && this.node.parent.x > 0) || (this.isChangeRotateDir && this.node.parent.scaleX < 0)) {
  40. this.speed = -this.speed;
  41. }
  42. };
  43. NewClass.prototype.update = function (dt) {
  44. if (!this.isRotate)
  45. return;
  46. this.node.angle += this.speed;
  47. };
  48. __decorate([
  49. property
  50. ], NewClass.prototype, "speed", void 0);
  51. __decorate([
  52. property
  53. ], NewClass.prototype, "isRotate", void 0);
  54. __decorate([
  55. property
  56. ], NewClass.prototype, "isChangeDir", void 0);
  57. __decorate([
  58. property
  59. ], NewClass.prototype, "isChangeRotateDir", void 0);
  60. NewClass = __decorate([
  61. ccclass
  62. ], NewClass);
  63. return NewClass;
  64. }(cc.Component));
  65. exports.default = NewClass;
  66. cc._RF.pop();