System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) { "use strict"; var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, instantiate, math, Node, Prefab, bullet, constant, enemyPlane, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _crd, ccclass, property, gameMangager; function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); } function _reportPossibleCrUseOfbullet(extras) { _reporterNs.report("bullet", "../bullet/bullet", _context.meta, extras); } function _reportPossibleCrUseOfconstant(extras) { _reporterNs.report("constant", "./constant", _context.meta, extras); } function _reportPossibleCrUseOfenemyPlane(extras) { _reporterNs.report("enemyPlane", "../plane/enemyPlane", _context.meta, extras); } return { setters: [function (_unresolved_) { _reporterNs = _unresolved_; }, function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; _decorator = _cc._decorator; Component = _cc.Component; instantiate = _cc.instantiate; math = _cc.math; Node = _cc.Node; Prefab = _cc.Prefab; }, function (_unresolved_2) { bullet = _unresolved_2.bullet; }, function (_unresolved_3) { constant = _unresolved_3.constant; }, function (_unresolved_4) { enemyPlane = _unresolved_4.enemyPlane; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "2839ePij2VDYp+PBYGbp5DS", "gameMangager", undefined); __checkObsolete__(['_decorator', 'Component', 'instantiate', 'math', 'Node', 'Prefab']); ({ ccclass, property } = _decorator); _export("gameMangager", gameMangager = (_dec = ccclass('gameMangager'), _dec2 = property(Node), _dec3 = property(Prefab), _dec4 = property(Prefab), _dec5 = property(Prefab), _dec6 = property(Prefab), _dec7 = property(Prefab), _dec8 = property(Node), _dec9 = property(Prefab), _dec10 = property(Prefab), _dec(_class = (_class2 = class gameMangager extends Component { constructor(...args) { super(...args); _initializerDefineProperty(this, "playerPlane", _descriptor, this); // bullet _initializerDefineProperty(this, "bullet01", _descriptor2, this); _initializerDefineProperty(this, "bullet02", _descriptor3, this); _initializerDefineProperty(this, "bullet03", _descriptor4, this); _initializerDefineProperty(this, "bullet04", _descriptor5, this); _initializerDefineProperty(this, "bullet05", _descriptor6, this); _initializerDefineProperty(this, "shootTime", _descriptor7, this); // 子弹周期 _initializerDefineProperty(this, "bulletSpeed", _descriptor8, this); // 子弹速度 _initializerDefineProperty(this, "bulletRoot", _descriptor9, this); // 敌机 _initializerDefineProperty(this, "enemyPlane01", _descriptor10, this); _initializerDefineProperty(this, "enemyPlane02", _descriptor11, this); _initializerDefineProperty(this, "createEnemyTime", _descriptor12, this); _initializerDefineProperty(this, "enemySpeed1", _descriptor13, this); _initializerDefineProperty(this, "enemySpeed2", _descriptor14, this); this._currShootTime = 0; this._isShooting = false; this._currCreatEnemyTime = 0; this._comBinationInterval = (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).Combination.PLAN1; // 获取分数 this.score = 0; } start() { this._init(); } update(deltaTime) { this._currShootTime += deltaTime; if (this._isShooting && this._currShootTime > this.shootTime) { this.createPlayerBullet(); this._currShootTime = 0; } // 敌机类型 this._currCreatEnemyTime += deltaTime; if (this._comBinationInterval === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).Combination.PLAN1) { if (this._currCreatEnemyTime > this.createEnemyTime) { this.createEnemyPlane(); this._currCreatEnemyTime = 0; } } else if (this._comBinationInterval === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).Combination.PLAN2) { if (this._currCreatEnemyTime > this.createEnemyTime * 0.9) { const randomCombiation = math.randomRangeInt(1, 3); if (randomCombiation === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).Combination.PLAN2) { this.createCombination1(); } else { this.createEnemyPlane(); } this._currCreatEnemyTime = 0; } } else { if (this._currCreatEnemyTime > this.createEnemyTime * 0.8) { const randomCombiation = math.randomRangeInt(1, 4); if (randomCombiation === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).Combination.PLAN2) { this.createCombination1(); } else if (randomCombiation === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).Combination.PLAN3) { this.createCombination2(); } else { this.createEnemyPlane(); } this._currCreatEnemyTime = 0; } } } // 创建子弹 createPlayerBullet() { const bullet01 = instantiate(this.bullet01); bullet01.setParent(this.bulletRoot); const pos = this.playerPlane.position; bullet01.setPosition(pos.x + 0, pos.y, pos.z); const bulletComp = bullet01.getComponent(_crd && bullet === void 0 ? (_reportPossibleCrUseOfbullet({ error: Error() }), bullet) : bullet); bulletComp.bulletSpeed = this.bulletSpeed; } // 创建敌机 createEnemyPlane() { const whichEnemy = math.randomRangeInt(1, 3); let prefab = null; let speed = 0; if (whichEnemy == (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({ error: Error() }), constant) : constant).EnemyPlaneType.TYPE1) { prefab = this.enemyPlane01; speed = this.enemySpeed1; } else { prefab = this.enemyPlane02; speed = this.enemySpeed2; } const enemy = instantiate(prefab); enemy.setParent(this.node); const enemyComp = enemy.getComponent(_crd && enemyPlane === void 0 ? (_reportPossibleCrUseOfenemyPlane({ error: Error() }), enemyPlane) : enemyPlane); enemyComp.show(this, speed); const randomPos = math.randomRangeInt(-11, 11); enemy.setPosition(30, 0, randomPos); } createCombination1() { const enemyArry = new Array(3); for (let i = 0; i < enemyArry.length; i++) { enemyArry[i] = instantiate(this.enemyPlane01); const element = enemyArry[i]; element.parent = this.node; element.setPosition(30, 0, -6 + i * 6); const enemyComp = element.getComponent(_crd && enemyPlane === void 0 ? (_reportPossibleCrUseOfenemyPlane({ error: Error() }), enemyPlane) : enemyPlane); enemyComp.show(this, this.enemySpeed1); } } createCombination2() { const enemyArry = new Array(5); const combinationPost = [-8, 0, 40, -4, 0, 35, 0, 0, 30, 4, 0, 35, 8, 0, 40]; for (let i = 0; i < enemyArry.length; i++) { enemyArry[i] = instantiate(this.enemyPlane02); const element = enemyArry[i]; element.parent = this.node; const startIndex = i * 3; element.setPosition(combinationPost[startIndex + 2], combinationPost[startIndex + 1], combinationPost[startIndex]); const enemyComp = element.getComponent(_crd && enemyPlane === void 0 ? (_reportPossibleCrUseOfenemyPlane({ error: Error() }), enemyPlane) : enemyPlane); enemyComp.show(this, this.enemySpeed2); } } // 是否发射 isShooting(val) { this._isShooting = val; } // 初始化 _init() { this._currShootTime = this.shootTime; this.changePlaneMode(); } // 循环加载 changePlaneMode() { this.schedule(this._modeChanged, 10, 3); } _modeChanged() { this._comBinationInterval++; } addScore() { this.score++; console.log('分数:' + this.score); } }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "playerPlane", [_dec2], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "bullet01", [_dec3], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "bullet02", [_dec4], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "bullet03", [_dec5], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "bullet04", [_dec6], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "bullet05", [_dec7], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "shootTime", [property], { configurable: true, enumerable: true, writable: true, initializer: function () { return 0.1; } }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "bulletSpeed", [property], { configurable: true, enumerable: true, writable: true, initializer: function () { return 1; } }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "bulletRoot", [_dec8], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "enemyPlane01", [_dec9], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "enemyPlane02", [_dec10], { configurable: true, enumerable: true, writable: true, initializer: function () { return null; } }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "createEnemyTime", [property], { configurable: true, enumerable: true, writable: true, initializer: function () { return 50; } }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "enemySpeed1", [property], { configurable: true, enumerable: true, writable: true, initializer: function () { return 0.01; } }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "enemySpeed2", [property], { configurable: true, enumerable: true, writable: true, initializer: function () { return 0.01; } })), _class2)) || _class)); _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=60a3cc3dac2a575cb9c89501ac659832dcff1e40.js.map