b589c4f8-9145-4223-9ff8-ecb494513891.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. "use strict";
  2. cc._RF.push(module, 'b589cT4kUVCI5/47LSUUTiR', 'boli');
  3. // Script/boli.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 boli = /** @class */ (function (_super) {
  28. __extends(boli, _super);
  29. function boli() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. /**
  32. * 落脚点类型 5:玻璃
  33. */
  34. _this.KIND_FootHold = 5;
  35. /**
  36. * player是否落在落脚点上,默认false,没有
  37. */
  38. _this.isHold = false;
  39. _this.NodeH = 40;
  40. _this.main = null;
  41. /**
  42. * 落脚点对应动画
  43. */
  44. _this.Ani = null;
  45. _this.AniState = null;
  46. _this.gainSc = false;
  47. return _this;
  48. }
  49. boli.prototype.onLoad = function () {
  50. this.node.y = -500;
  51. this.node.x = (Math.random() * 2 - 1) * 140;
  52. this.Ani = this.node.getComponent(cc.Animation);
  53. };
  54. boli.prototype.start = function () {
  55. };
  56. boli.prototype.update = function (dt) {
  57. var self = this;
  58. if (Global_1.default.instance.OverFlag) {
  59. self.enabled = false;
  60. }
  61. else {
  62. this.node.active = true;
  63. this.node.y += Global_1.default.instance.FHFallSpeed;
  64. if (this.node.isHold) {
  65. Global_1.default.instance.CollisionFlag = true;
  66. Global_1.default.instance.TheHolder = this.node;
  67. }
  68. if (this.node.y > 360) {
  69. if (this.node.isHold) {
  70. this.node.isHold = false;
  71. Global_1.default.instance.CollisionFlag = false;
  72. }
  73. this.node.destroy();
  74. }
  75. }
  76. };
  77. /**
  78. * 初始化函数
  79. * @param main 主场景
  80. */
  81. boli.prototype.init = function (main) {
  82. this.main = main;
  83. };
  84. /**
  85. * 获取落脚点类型
  86. */
  87. boli.prototype.getKind = function () {
  88. return this.KIND_FootHold;
  89. };
  90. boli.prototype.onCollisionEnter = function (other, self) {
  91. // let spawn;
  92. var rootself = this;
  93. Global_1.default.instance.KIND_FootHold = this.KIND_FootHold;
  94. Global_1.default.instance.TheHolder = this.node;
  95. self.node.isHold = true;
  96. Global_1.default.instance.CollisionFlag = true;
  97. if (other.tag == 111) {
  98. console.log("我被撞到了");
  99. rootself.main.Score();
  100. rootself.gainSc = true;
  101. return;
  102. }
  103. // this.main.Score();
  104. this.scheduleOnce(function () {
  105. this.AniState = this.Ani.play("boli");
  106. rootself.node.isHold = false;
  107. Global_1.default.instance.CollisionFlag = false;
  108. self.destroy();
  109. }, 0.5);
  110. };
  111. __decorate([
  112. property(Boolean)
  113. ], boli.prototype, "isHold", void 0);
  114. __decorate([
  115. property(Number)
  116. ], boli.prototype, "NodeH", void 0);
  117. boli = __decorate([
  118. ccclass
  119. ], boli);
  120. return boli;
  121. }(cc.Component));
  122. exports.default = boli;
  123. cc._RF.pop();