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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.onLoad = 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. }
  53. else {
  54. this.node.parent.x--;
  55. var x = this.node.parent.isHold;
  56. if (x || this.node.parent.getComponent("GD").isHold) {
  57. Global_1.default.instance.LorR = 1;
  58. }
  59. }
  60. };
  61. NewClass.prototype.onCollisionEnter = function () {
  62. var self = this;
  63. if (self.CliLorR == 0) {
  64. self.CliLorR = 1;
  65. Global_1.default.instance.LorR = 1;
  66. // console.log("这里是CliGD的if"+Global.instance.LorR);
  67. }
  68. else {
  69. self.CliLorR = 0;
  70. Global_1.default.instance.LorR = 0;
  71. // console.log("这里是CliGD的else"+Global.instance.LorR);
  72. }
  73. };
  74. __decorate([
  75. property(Number)
  76. ], NewClass.prototype, "CliLorR", void 0);
  77. NewClass = __decorate([
  78. ccclass
  79. ], NewClass);
  80. return NewClass;
  81. }(cc.Component));
  82. exports.default = NewClass;
  83. cc._RF.pop();