2fd093dd-24f4-4b8a-a9f7-9349fd960ead.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. "use strict";
  2. cc._RF.push(module, '2fd09PdJPRLiqn3k0n9lg6t', 'CliGD');
  3. // Script/CliGD.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 Global_1 = require("./Global");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var NewClass = /** @class */ (function (_super) {
  28. __extends(NewClass, _super);
  29. function NewClass() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. /**0 for right */
  32. _this.CliLorR = 0;
  33. return _this;
  34. }
  35. NewClass.prototype.onEnable = function () {
  36. if (Math.random() < 0.5) {
  37. this.CliLorR = 0;
  38. }
  39. else {
  40. this.CliLorR = 1;
  41. }
  42. };
  43. NewClass.prototype.start = function () {
  44. };
  45. NewClass.prototype.update = function (dt) {
  46. if (this.CliLorR == 0) {
  47. this.node.parent.x++;
  48. var x = this.node.parent.isHold;
  49. if (x || this.node.parent.getComponent("GD").isHold) {
  50. Global_1.default.instance.LorR = 0;
  51. }
  52. if (this.node.parent.x > 160) {
  53. this.CliLorR = 1;
  54. }
  55. }
  56. else {
  57. this.node.parent.x--;
  58. var x = this.node.parent.isHold;
  59. if (x || this.node.parent.getComponent("GD").isHold) {
  60. Global_1.default.instance.LorR = 1;
  61. }
  62. if (this.node.parent.x < -160) {
  63. this.CliLorR = 0;
  64. }
  65. }
  66. };
  67. NewClass.prototype.onCollisionEnter = function () {
  68. // if (this.CliLorR === 1) {
  69. // this.CliLorR = 0;
  70. // }
  71. // else {
  72. // this.CliLorR = 1;
  73. // }
  74. return;
  75. if (this.CliLorR === 0) {
  76. this.CliLorR = 1;
  77. Global_1.default.instance.LorR = 1;
  78. // console.log("这里是CliGD的if"+Global.instance.LorR);
  79. }
  80. else {
  81. this.CliLorR = 0;
  82. Global_1.default.instance.LorR = 0;
  83. // console.log("这里是CliGD的else"+Global.instance.LorR);
  84. }
  85. };
  86. __decorate([
  87. property(Number)
  88. ], NewClass.prototype, "CliLorR", void 0);
  89. NewClass = __decorate([
  90. ccclass
  91. ], NewClass);
  92. return NewClass;
  93. }(cc.Component));
  94. exports.default = NewClass;
  95. cc._RF.pop();