6716c2a7-1fe6-451e-8525-9f56c7286812.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. "use strict";
  2. cc._RF.push(module, '6716cKnH+ZFHoUln1bHKGgS', 'dici');
  3. // Script/dici.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. /**
  32. * 落脚点类型 6:地刺
  33. */
  34. _this.KIND_FootHold = 6;
  35. /**
  36. * player是否落在落脚点上,默认false,没有
  37. */
  38. _this.isHold = false;
  39. _this.NodeH = 80;
  40. _this.GoUp = false;
  41. _this.main = null;
  42. /**
  43. * 落脚点对应动画
  44. */
  45. _this.Ani = null;
  46. _this.AniState = null;
  47. _this.gainSc = false;
  48. _this.InjuredF = false;
  49. return _this;
  50. }
  51. // LIFE-CYCLE CALLBACKS:
  52. NewClass.prototype.onLoad = function () {
  53. this.node.y = -500;
  54. this.node.x = (Math.random() * 2 - 1) * 140;
  55. this.Ani = this.node.getComponent(cc.Animation);
  56. };
  57. NewClass.prototype.start = function () {
  58. };
  59. NewClass.prototype.update = function (dt) {
  60. // console.log(Global.instance.CollisionFlag);
  61. var self = this;
  62. if (Global_1.default.instance.OverFlag) {
  63. self.enabled = false;
  64. }
  65. else {
  66. this.node.active = true;
  67. this.node.y += Global_1.default.instance.FHFallSpeed;
  68. if (this.node.isHold) {
  69. Global_1.default.instance.CollisionFlag = true;
  70. Global_1.default.instance.TheHolder = this.node;
  71. }
  72. if (this.node.y > 360) {
  73. if (this.node.isHold) {
  74. Global_1.default.instance.CollisionFlag = false;
  75. this.node.isHold = false;
  76. }
  77. this.node.destroy();
  78. }
  79. }
  80. };
  81. /**
  82. * 初始化函数
  83. * @param main 主场景
  84. */
  85. NewClass.prototype.init = function (main) {
  86. this.main = main;
  87. };
  88. /**
  89. * 获取落脚点类型
  90. */
  91. NewClass.prototype.getKind = function () {
  92. return this.KIND_FootHold;
  93. };
  94. NewClass.prototype.onCollisionEnter = function (other, self) {
  95. var rootself = this;
  96. if (rootself.GoUp) {
  97. return;
  98. }
  99. if (other.tag == 111) {
  100. console.log("我被撞到了");
  101. rootself.main.Score();
  102. rootself.gainSc = true;
  103. return;
  104. }
  105. else {
  106. Global_1.default.instance.TheHolder = this.node;
  107. Global_1.default.instance.KIND_FootHold = this.KIND_FootHold;
  108. rootself.node.isHold = true;
  109. self.node.isHold = true;
  110. if (!rootself.InjuredF) {
  111. Global_1.default.instance.Injured = true;
  112. rootself.InjuredF = true;
  113. }
  114. // this.main.Score();
  115. if (!Global_1.default.instance.CollisionFlag) {
  116. Global_1.default.instance.CollisionFlag = true;
  117. rootself.node.isHold = true;
  118. self.node.isHold = true;
  119. rootself.AniState = rootself.Ani.play("dici");
  120. rootself.AniState.repeatCount = 100;
  121. }
  122. }
  123. };
  124. __decorate([
  125. property(Boolean)
  126. ], NewClass.prototype, "isHold", void 0);
  127. __decorate([
  128. property(Number)
  129. ], NewClass.prototype, "NodeH", void 0);
  130. NewClass = __decorate([
  131. ccclass
  132. ], NewClass);
  133. return NewClass;
  134. }(cc.Component));
  135. exports.default = NewClass;
  136. /**
  137. * 地刺的问题貌似还没有解决
  138. * 不知道哪里有问题
  139. * 地刺的问题到底是碰撞标志位被修改了。
  140. *
  141. */
  142. cc._RF.pop();