123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Collider, Component, constant, _dec, _class, _crd, ccclass, property, OUTOFBOUNCE, enemyPlane;
- function _reportPossibleCrUseOfconstant(extras) {
- _reporterNs.report("constant", "../framework/constant", _context.meta, extras);
- }
- function _reportPossibleCrUseOfgameMangager(extras) {
- _reporterNs.report("gameMangager", "../framework/gameMangager", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- Collider = _cc.Collider;
- Component = _cc.Component;
- }, function (_unresolved_2) {
- constant = _unresolved_2.constant;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "fd1ddS50lhH3LjBrCyqMPL7", "enemyPlane", undefined);
- __checkObsolete__(['_decorator', 'Collider', 'Component', 'ITriggerEvent', 'Node', 'sp']);
- ({
- ccclass,
- property
- } = _decorator);
- OUTOFBOUNCE = 50;
- _export("enemyPlane", enemyPlane = (_dec = ccclass('enemyPlane'), _dec(_class = class enemyPlane extends Component {
- constructor(...args) {
- super(...args);
- // @property
- // public enemySpeed = 0;
- this._enemySpeed = 0;
- this.enemyType = (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({
- error: Error()
- }), constant) : constant).EnemyPlaneType.TYPE1;
- this._gameManager = null;
- }
- start() {}
- update(deltaTime) {
- const pos = this.node.position;
- const movePos = pos.x - this._enemySpeed;
- this.node.setPosition(movePos, pos.y, pos.z);
- if (movePos > OUTOFBOUNCE) {
- this.node.destroy();
- }
- }
- show(gameManager, speed) {
- this._gameManager = gameManager;
- this._enemySpeed = speed;
- } // 碰撞业务
- onEnable() {
- const collider = this.getComponent(Collider);
- collider.on('onTriggerEnter', this._onTriggerEnter, this);
- }
- onDisable() {
- const collider = this.getComponent(Collider);
- collider.off('onTriggerEnter', this._onTriggerEnter, this);
- }
- _onTriggerEnter(event) {
- const collisionGroup = event.otherCollider.getGroup();
- console.log('敌人');
- if (collisionGroup === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({
- error: Error()
- }), constant) : constant).CollisionType.SELF_BULLET || collisionGroup === (_crd && constant === void 0 ? (_reportPossibleCrUseOfconstant({
- error: Error()
- }), constant) : constant).CollisionType.SELF_PLANE) {
- this.node.destroy();
- this._gameManager.addScore();
- }
- }
- }) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=317cdf1a2cc677419bfe696f1a4a7546f5b13f08.js.map
|