"use strict"; cc._RF.push(module, 'b589cT4kUVCI5/47LSUUTiR', 'boli'); // Script/boli.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var Global_1 = require("./Global"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var boli = /** @class */ (function (_super) { __extends(boli, _super); function boli() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * 落脚点类型 5:玻璃 */ _this.KIND_FootHold = 5; /** * player是否落在落脚点上,默认false,没有 */ _this.isHold = false; _this.NodeH = 40; _this.main = null; /** * 落脚点对应动画 */ _this.Ani = null; _this.AniState = null; _this.gainSc = false; return _this; } boli.prototype.onLoad = function () { this.node.y = -500; this.node.x = (Math.random() * 2 - 1) * 140; this.Ani = this.node.getComponent(cc.Animation); }; boli.prototype.start = function () { }; boli.prototype.update = function (dt) { var self = this; if (Global_1.default.instance.OverFlag) { self.enabled = false; } else { this.node.active = true; this.node.y += Global_1.default.instance.FHFallSpeed; if (this.node.isHold) { Global_1.default.instance.CollisionFlag = true; Global_1.default.instance.TheHolder = this.node; } if (this.node.y > 360) { if (this.node.isHold) { this.node.isHold = false; Global_1.default.instance.CollisionFlag = false; } this.node.destroy(); } } }; /** * 初始化函数 * @param main 主场景 */ boli.prototype.init = function (main) { this.main = main; }; /** * 获取落脚点类型 */ boli.prototype.getKind = function () { return this.KIND_FootHold; }; boli.prototype.onCollisionEnter = function (other, self) { // let spawn; var rootself = this; Global_1.default.instance.KIND_FootHold = this.KIND_FootHold; Global_1.default.instance.TheHolder = this.node; self.node.isHold = true; Global_1.default.instance.CollisionFlag = true; if (other.tag == 111) { console.log("我被撞到了"); rootself.main.Score(); rootself.gainSc = true; return; } // this.main.Score(); this.scheduleOnce(function () { this.AniState = this.Ani.play("boli"); rootself.node.isHold = false; Global_1.default.instance.CollisionFlag = false; self.destroy(); }, 0.5); }; __decorate([ property(Boolean) ], boli.prototype, "isHold", void 0); __decorate([ property(Number) ], boli.prototype, "NodeH", void 0); boli = __decorate([ ccclass ], boli); return boli; }(cc.Component)); exports.default = boli; cc._RF.pop();