|
|
@@ -131,13 +131,11 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 获取关卡配置管理器实例
|
|
|
if (this.levelConfigManagerNode) {
|
|
|
this.levelConfigManager = this.levelConfigManagerNode.getComponent(LevelConfigManager) || null;
|
|
|
- if (this.levelConfigManager) {
|
|
|
- console.log('[EnemyController] LevelConfigManager组件已通过装饰器绑定');
|
|
|
- } else {
|
|
|
- console.warn('[EnemyController] LevelConfigManager节点上未找到LevelConfigManager组件');
|
|
|
+ if (!this.levelConfigManager) {
|
|
|
+ // LevelConfigManager节点上未找到LevelConfigManager组件
|
|
|
}
|
|
|
} else {
|
|
|
- console.warn('[EnemyController] levelConfigManagerNode未通过装饰器绑定,请在编辑器中拖拽Canvas/LevelConfigManager节点');
|
|
|
+ // levelConfigManagerNode未通过装饰器绑定,请在编辑器中拖拽Canvas/LevelConfigManager节点
|
|
|
this.levelConfigManager = null;
|
|
|
}
|
|
|
|
|
|
@@ -145,7 +143,7 @@ export class EnemyController extends BaseSingleton {
|
|
|
if (!this.enemyContainer) {
|
|
|
this.enemyContainer = find('Canvas/GameLevelUI/enemyContainer');
|
|
|
if (!this.enemyContainer) {
|
|
|
- console.warn('找不到enemyContainer节点,将尝试创建');
|
|
|
+ // 找不到enemyContainer节点,将尝试创建
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -160,7 +158,7 @@ export class EnemyController extends BaseSingleton {
|
|
|
} else if (this.bottomFenceNode && this.bottomFenceNode.getComponent(Wall)) {
|
|
|
this.wallComponent = this.bottomFenceNode.getComponent(Wall);
|
|
|
} else {
|
|
|
- console.warn('[EnemyController] 未找到墙体组件,将无法处理墙体伤害');
|
|
|
+ // 未找到墙体组件,将无法处理墙体伤害
|
|
|
}
|
|
|
|
|
|
// 确保enemyContainer节点存在
|
|
|
@@ -168,14 +166,10 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
// UI节点已通过装饰器拖拽绑定,无需find查找
|
|
|
if (!this.enemyCountLabelNode) {
|
|
|
- console.warn('[EnemyController] enemyCountLabelNode 未通过装饰器绑定,请在编辑器中拖拽 Canvas-001/TopArea/EnemyNode/EnemyNumber 节点');
|
|
|
- } else {
|
|
|
- console.log('[EnemyController] enemyCountLabelNode 已通过装饰器绑定');
|
|
|
+ // enemyCountLabelNode 未通过装饰器绑定,请在编辑器中拖拽 Canvas-001/TopArea/EnemyNode/EnemyNumber 节点
|
|
|
}
|
|
|
if (!this.waveNumberLabelNode) {
|
|
|
- console.warn('[EnemyController] waveNumberLabelNode 未通过装饰器绑定,请在编辑器中拖拽 Canvas-001/TopArea/WaveInfo/WaveNumber 节点');
|
|
|
- } else {
|
|
|
- console.log('[EnemyController] waveNumberLabelNode 已通过装饰器绑定');
|
|
|
+ // waveNumberLabelNode 未通过装饰器绑定,请在编辑器中拖拽 Canvas-001/TopArea/WaveInfo/WaveNumber 节点
|
|
|
}
|
|
|
|
|
|
// 初始化敌人数量显示
|
|
|
@@ -248,7 +242,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 处理游戏暂停事件
|
|
|
*/
|
|
|
private onGamePauseEvent() {
|
|
|
- console.log('[EnemyController] 接收到游戏暂停事件,暂停所有敌人');
|
|
|
this.pauseAllEnemies();
|
|
|
this.pauseSpawning();
|
|
|
}
|
|
|
@@ -257,7 +250,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 处理游戏恢复事件
|
|
|
*/
|
|
|
private onGameResumeEvent() {
|
|
|
- console.log('[EnemyController] 接收到游戏恢复事件,恢复所有敌人');
|
|
|
this.resumeAllEnemies();
|
|
|
|
|
|
// 通过事件检查游戏状态,决定是否恢复敌人生成
|
|
|
@@ -268,7 +260,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 处理游戏结束事件
|
|
|
*/
|
|
|
private onGameEndEvent() {
|
|
|
- console.log('[EnemyController] 接收到游戏结束事件,停止敌人生成');
|
|
|
this.stopGame(false); // 停止游戏但不清除敌人
|
|
|
}
|
|
|
|
|
|
@@ -276,7 +267,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 处理游戏失败事件
|
|
|
*/
|
|
|
private onGameDefeatEvent() {
|
|
|
- console.log('[EnemyController] 接收到游戏失败事件,直接删除所有敌人');
|
|
|
this.stopGame(true); // 停止游戏并清除所有敌人
|
|
|
}
|
|
|
|
|
|
@@ -284,7 +274,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 处理清除所有游戏对象事件
|
|
|
*/
|
|
|
private onClearAllGameObjectsEvent() {
|
|
|
- console.log('[EnemyController] 接收到清除所有游戏对象事件,清除所有敌人');
|
|
|
this.clearAllEnemies(false); // 清除敌人但不触发事件
|
|
|
}
|
|
|
|
|
|
@@ -292,7 +281,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 处理重置敌人控制器事件
|
|
|
*/
|
|
|
private onResetEnemyControllerEvent() {
|
|
|
- console.log('[EnemyController] 接收到重置敌人控制器事件,重置到初始状态');
|
|
|
this.resetToInitialState();
|
|
|
}
|
|
|
|
|
|
@@ -438,7 +426,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
for (const wallNode of this.wallNodes) {
|
|
|
this.wallComponent = wallNode.getComponent(Wall);
|
|
|
if (this.wallComponent) {
|
|
|
- console.log('[EnemyController] 找到墙体组件');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -457,7 +444,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 尝试查找节点
|
|
|
this.enemyContainer = find('Canvas/GameLevelUI/enemyContainer');
|
|
|
if (this.enemyContainer) {
|
|
|
- console.log('找到已存在的enemyContainer节点');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -473,7 +459,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
if (!this.enemyContainer.getComponent(UITransform)) {
|
|
|
this.enemyContainer.addComponent(UITransform);
|
|
|
}
|
|
|
- console.log('已在GameLevelUI下创建enemyContainer节点');
|
|
|
}
|
|
|
|
|
|
// 游戏开始
|
|
|
@@ -487,12 +472,9 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
// 确保先取消之前的定时器,避免重复调度
|
|
|
this.unschedule(this.spawnEnemy);
|
|
|
- console.log(`[EnemyController] 开始敌人生成定时器,间隔: ${this.spawnInterval}秒,当前已生成: ${this.currentWaveEnemiesSpawned}/${this.currentWaveTotalEnemies}`);
|
|
|
|
|
|
// 开始生成敌人
|
|
|
this.schedule(this.spawnEnemy, this.spawnInterval);
|
|
|
-
|
|
|
- console.log(`[EnemyController] 开始生成敌人,当前波次: ${this.currentWave}, 需要生成: ${this.currentWaveTotalEnemies} 个敌人`);
|
|
|
}
|
|
|
|
|
|
// 游戏结束
|
|
|
@@ -507,19 +489,18 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 清除敌人,在重置状态时不触发事件,避免错误的游戏成功判定
|
|
|
this.clearAllEnemies(false);
|
|
|
}
|
|
|
-
|
|
|
- console.log('停止生成敌人');
|
|
|
}
|
|
|
|
|
|
// 生成敌人
|
|
|
async spawnEnemy() {
|
|
|
- if (!this.gameStarted || !this.enemyPrefab) return;
|
|
|
+ if (!this.gameStarted || !this.enemyPrefab) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
// 游戏状态检查现在通过事件系统处理
|
|
|
|
|
|
// 检查是否已达到当前波次的敌人生成上限
|
|
|
if (this.currentWaveEnemiesSpawned >= this.currentWaveTotalEnemies) {
|
|
|
- console.log(`[EnemyController] 当前波次敌人已全部生成 (${this.currentWaveEnemiesSpawned}/${this.currentWaveTotalEnemies}),停止生成`);
|
|
|
this.unschedule(this.spawnEnemy); // 停止定时生成
|
|
|
return;
|
|
|
}
|
|
|
@@ -574,15 +555,12 @@ export class EnemyController extends BaseSingleton {
|
|
|
const mapping = this.configManager.getNameToIdMapping();
|
|
|
if (mapping && mapping[enemyType]) {
|
|
|
enemyId = mapping[enemyType];
|
|
|
- console.log(`[EnemyController] 敌人名称映射: ${enemyType} -> ${enemyId}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
enemyConfig = this.configManager.getEnemyById(enemyId) || this.configManager.getRandomEnemy();
|
|
|
- console.log(`[EnemyController] 使用波次配置敌人类型: ${enemyType} (ID: ${enemyId}), 配置索引: ${configIndex}`);
|
|
|
} else {
|
|
|
enemyConfig = this.configManager.getRandomEnemy();
|
|
|
- console.log(`[EnemyController] 使用随机敌人类型`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -590,20 +568,39 @@ export class EnemyController extends BaseSingleton {
|
|
|
const healthMultiplier = await this.getCurrentHealthMultiplier();
|
|
|
|
|
|
if (enemyConfig) {
|
|
|
- // 添加EnemyComponent保存配置
|
|
|
- const cfgComp = enemy.addComponent(EnemyComponent);
|
|
|
- cfgComp.enemyConfig = enemyConfig;
|
|
|
- cfgComp.spawner = this;
|
|
|
+ try {
|
|
|
+ const cfgComp = enemy.addComponent(EnemyComponent);
|
|
|
+ cfgComp.enemyConfig = enemyConfig;
|
|
|
+ cfgComp.spawner = this;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`[EnemyController] 添加EnemyComponent失败:`, error);
|
|
|
+ }
|
|
|
|
|
|
// 应用数值,血量乘以倍率
|
|
|
- const baseHealth = enemyConfig.stats.health;
|
|
|
- const finalHealth = Math.round(baseHealth * healthMultiplier);
|
|
|
- enemyComp.health = finalHealth;
|
|
|
- enemyComp.maxHealth = finalHealth;
|
|
|
- enemyComp.speed = enemyConfig.stats.speed;
|
|
|
- enemyComp.attackPower = enemyConfig.stats.damage;
|
|
|
-
|
|
|
- console.log(`[EnemyController] 敌人血量: ${baseHealth} * ${healthMultiplier} = ${finalHealth}`);
|
|
|
+ let baseHealth, finalHealth;
|
|
|
+ try {
|
|
|
+ let speed, attackPower;
|
|
|
+
|
|
|
+ // 根据更新后的EnemyConfig接口访问属性
|
|
|
+ baseHealth = enemyConfig.health;
|
|
|
+ speed = enemyConfig.speed;
|
|
|
+ attackPower = enemyConfig.attack;
|
|
|
+
|
|
|
+ finalHealth = Math.round(baseHealth * healthMultiplier);
|
|
|
+ enemyComp.health = finalHealth;
|
|
|
+ enemyComp.maxHealth = finalHealth;
|
|
|
+ enemyComp.speed = speed;
|
|
|
+ enemyComp.attackPower = attackPower;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`[EnemyController] 应用敌人数值时出错:`, error);
|
|
|
+ // 使用默认值
|
|
|
+ baseHealth = this.defaultHealth;
|
|
|
+ finalHealth = Math.round(baseHealth * healthMultiplier);
|
|
|
+ enemyComp.health = finalHealth;
|
|
|
+ enemyComp.maxHealth = finalHealth;
|
|
|
+ enemyComp.speed = this.defaultEnemySpeed;
|
|
|
+ enemyComp.attackPower = this.defaultAttackPower;
|
|
|
+ }
|
|
|
|
|
|
// 加载动画
|
|
|
this.loadEnemyAnimation(enemy, enemyConfig);
|
|
|
@@ -614,8 +611,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
enemyComp.maxHealth = finalHealth;
|
|
|
enemyComp.speed = this.defaultEnemySpeed;
|
|
|
enemyComp.attackPower = this.defaultAttackPower;
|
|
|
-
|
|
|
- console.log(`[EnemyController] 默认敌人血量: ${this.defaultHealth} * ${healthMultiplier} = ${finalHealth}`);
|
|
|
}
|
|
|
|
|
|
// 额外的属性设置
|
|
|
@@ -632,21 +627,17 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
// 添加到活跃敌人列表
|
|
|
this.activeEnemies.push(enemy);
|
|
|
+
|
|
|
// 增加已生成敌人计数
|
|
|
this.currentWaveEnemiesSpawned++;
|
|
|
// 生成敌人时不更新敌人数量显示,避免重置计数
|
|
|
-
|
|
|
- console.log(`生成敌人,当前共有 ${this.activeEnemies.length} 个敌人 (已生成: ${this.currentWaveEnemiesSpawned}/${this.currentWaveTotalEnemies})`);
|
|
|
}
|
|
|
|
|
|
// 清除所有敌人
|
|
|
clearAllEnemies(triggerEvents: boolean = true) {
|
|
|
- console.log(`[EnemyController] 开始清除所有敌人,triggerEvents: ${triggerEvents}`);
|
|
|
-
|
|
|
// 设置清理标志,阻止清理过程中触发游戏胜利判断
|
|
|
if (!triggerEvents) {
|
|
|
this.isClearing = true;
|
|
|
- console.log('[EnemyController] 设置清理标志,阻止触发游戏事件');
|
|
|
}
|
|
|
|
|
|
// 如果不触发事件,先暂时禁用 notifyEnemyDead 方法
|
|
|
@@ -654,10 +645,7 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
if (!triggerEvents) {
|
|
|
// 临时替换为空函数
|
|
|
- this.notifyEnemyDead = () => {
|
|
|
- console.log('[EnemyController] notifyEnemyDead 被调用但已被禁用(清理模式)');
|
|
|
- };
|
|
|
- console.log('[EnemyController] 临时禁用敌人死亡通知');
|
|
|
+ this.notifyEnemyDead = () => {};
|
|
|
}
|
|
|
|
|
|
for (const enemy of this.activeEnemies) {
|
|
|
@@ -669,7 +657,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 恢复原来的方法
|
|
|
if (!triggerEvents) {
|
|
|
this.notifyEnemyDead = originalNotifyMethod;
|
|
|
- console.log('[EnemyController] 恢复敌人死亡通知');
|
|
|
}
|
|
|
|
|
|
this.activeEnemies = [];
|
|
|
@@ -677,7 +664,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 重置清理标志
|
|
|
if (!triggerEvents) {
|
|
|
this.isClearing = false;
|
|
|
- console.log('[EnemyController] 清理完成,重置清理标志');
|
|
|
}
|
|
|
|
|
|
// 清除敌人时不更新敌人数量显示,避免重置计数
|
|
|
@@ -720,12 +706,26 @@ export class EnemyController extends BaseSingleton {
|
|
|
return activeCount > 0;
|
|
|
}
|
|
|
|
|
|
+ // 调试方法:检查enemyContainer中的实际敌人节点
|
|
|
+ private debugEnemyContainer() {
|
|
|
+ const enemyContainer = find('Canvas/GameLevelUI/enemyContainer');
|
|
|
+ if (!enemyContainer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let enemyNodeCount = 0;
|
|
|
+ enemyContainer.children.forEach((child, index) => {
|
|
|
+ if (child.name === 'Enemy' || child.name.includes('Enemy')) {
|
|
|
+ enemyNodeCount++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 调试方法:强制清理无效敌人引用
|
|
|
public debugCleanupEnemies() {
|
|
|
const beforeCount = this.activeEnemies.length;
|
|
|
this.activeEnemies = this.activeEnemies.filter(enemy => enemy && enemy.isValid);
|
|
|
const afterCount = this.activeEnemies.length;
|
|
|
- console.log(`[EnemyController] 清理无效敌人引用: ${beforeCount} -> ${afterCount}`);
|
|
|
return afterCount;
|
|
|
}
|
|
|
|
|
|
@@ -737,29 +737,23 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 暂停生成敌人
|
|
|
public pauseSpawning(): void {
|
|
|
if (this.gameStarted) {
|
|
|
- console.log('暂停生成敌人');
|
|
|
this.unschedule(this.spawnEnemy);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 恢复生成敌人
|
|
|
public resumeSpawning(): void {
|
|
|
- console.log(`[EnemyController] resumeSpawning() 调用: gameStarted=${this.gameStarted}, currentWave=${this.currentWave}, currentWaveEnemiesSpawned=${this.currentWaveEnemiesSpawned}, currentWaveTotalEnemies=${this.currentWaveTotalEnemies}`);
|
|
|
-
|
|
|
// 游戏状态检查现在通过事件系统处理
|
|
|
|
|
|
if (!this.gameStarted) {
|
|
|
- console.log('[EnemyController] 游戏未开始,不恢复敌人生成');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 检查是否已达到当前波次的敌人生成上限
|
|
|
if (this.currentWaveEnemiesSpawned >= this.currentWaveTotalEnemies) {
|
|
|
- console.log(`[EnemyController] 当前波次敌人已全部生成 (${this.currentWaveEnemiesSpawned}/${this.currentWaveTotalEnemies}),不恢复生成`);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- console.log(`[EnemyController] 恢复敌人生成,当前波次${this.currentWave},已生成: ${this.currentWaveEnemiesSpawned}/${this.currentWaveTotalEnemies}`);
|
|
|
// 确保先取消之前的定时器,避免重复调度
|
|
|
this.unschedule(this.spawnEnemy);
|
|
|
this.schedule(this.spawnEnemy, this.spawnInterval);
|
|
|
@@ -844,15 +838,11 @@ export class EnemyController extends BaseSingleton {
|
|
|
}
|
|
|
|
|
|
public forceEnemyAttack() {
|
|
|
- console.log('=== 强制所有敌人进入攻击状态 ===');
|
|
|
-
|
|
|
const activeEnemies = this.getActiveEnemies();
|
|
|
- console.log(`当前活跃敌人数量: ${activeEnemies.length}`);
|
|
|
|
|
|
for (const enemy of activeEnemies) {
|
|
|
const enemyComp = enemy.getComponent(EnemyInstance);
|
|
|
if (enemyComp) {
|
|
|
- console.log(`强制敌人 ${enemy.name} 进入攻击状态`);
|
|
|
// 直接调用damageWall方法进行测试
|
|
|
this.damageWall(enemyComp.attackPower);
|
|
|
}
|
|
|
@@ -861,11 +851,9 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
/** 供 EnemyInstance 在 onDestroy 中调用 */
|
|
|
public notifyEnemyDead(enemyNode?: Node) {
|
|
|
- console.log(`[EnemyController] notifyEnemyDead 被调用,敌人节点: ${!!enemyNode}, 清理模式: ${this.isClearing}`);
|
|
|
|
|
|
// 如果正在清理敌人,不触发任何游戏事件
|
|
|
if (this.isClearing) {
|
|
|
- console.log('[EnemyController] 正在清理敌人,跳过死亡事件处理');
|
|
|
if (enemyNode) {
|
|
|
const idx = this.activeEnemies.indexOf(enemyNode);
|
|
|
if (idx !== -1) {
|
|
|
@@ -877,10 +865,10 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
if (enemyNode) {
|
|
|
const idx = this.activeEnemies.indexOf(enemyNode);
|
|
|
- console.log(`[EnemyController] 在活跃敌人列表中查找敌人,索引: ${idx}, 列表长度: ${this.activeEnemies.length}`);
|
|
|
if (idx !== -1) {
|
|
|
this.activeEnemies.splice(idx, 1);
|
|
|
- console.log(`[EnemyController] 从活跃敌人列表中移除敌人,剩余: ${this.activeEnemies.length}`);
|
|
|
+ } else {
|
|
|
+ console.warn(`[EnemyController] 警告:尝试移除的敌人不在activeEnemies数组中!`);
|
|
|
}
|
|
|
// 移除EnemyController内部的击杀计数,统一由GameManager管理
|
|
|
// this.currentWaveEnemiesKilled++;
|
|
|
@@ -888,7 +876,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
}
|
|
|
|
|
|
// 直接通过事件总线发送ENEMY_KILLED事件,避免通过GamePause的双重调用
|
|
|
- console.log(`[EnemyController] 发送 ENEMY_KILLED 事件`);
|
|
|
const eventBus = EventBus.getInstance();
|
|
|
eventBus.emit('ENEMY_KILLED');
|
|
|
}
|
|
|
@@ -926,10 +913,8 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
if (skeleton.findAnimation(walkName)) {
|
|
|
skeleton.setAnimation(0, walkName, true);
|
|
|
- console.log(`[EnemyController] 成功播放walk动画: ${walkName}`);
|
|
|
} else if (skeleton.findAnimation(idleName)) {
|
|
|
skeleton.setAnimation(0, idleName, true);
|
|
|
- console.log(`[EnemyController] 成功播放idle动画: ${idleName}`);
|
|
|
} else {
|
|
|
console.warn(`[EnemyController] 未找到合适的动画,walk: ${walkName}, idle: ${idleName}`);
|
|
|
}
|
|
|
@@ -953,9 +938,7 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 如果没有传入击杀数量,则显示当前波次总敌人数(初始状态)
|
|
|
remaining = this.currentWaveTotalEnemies;
|
|
|
}
|
|
|
- const oldText = label.string;
|
|
|
label.string = remaining.toString();
|
|
|
- console.log(`[EnemyController] 更新敌人数量显示: "${oldText}" -> "${remaining}" (总数: ${this.currentWaveTotalEnemies}, 击杀数: ${killedCount ?? '未传入'}, 活跃敌人: ${this.getActiveEnemies().length})`);
|
|
|
} else {
|
|
|
console.warn('[EnemyController] enemyCountLabelNode 上未找到 Label 组件');
|
|
|
}
|
|
|
@@ -1002,7 +985,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
});
|
|
|
|
|
|
if (gameOver) {
|
|
|
- console.log('[EnemyController] 游戏已经结束,不显示波次提示');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -1025,7 +1007,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
});
|
|
|
|
|
|
if (gameOverCheck) {
|
|
|
- console.log('[EnemyController] 游戏已经结束,不启动敌人生成(延时检查)');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -1043,8 +1024,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
* 用于游戏重新开始时重置所有敌人相关状态
|
|
|
*/
|
|
|
public resetToInitialState(): void {
|
|
|
- console.log('[EnemyController] 开始重置到初始状态');
|
|
|
-
|
|
|
// 停止游戏并清理所有敌人
|
|
|
this.stopGame(true);
|
|
|
|
|
|
@@ -1065,8 +1044,6 @@ export class EnemyController extends BaseSingleton {
|
|
|
// 重置UI显示
|
|
|
this.updateEnemyCountLabel();
|
|
|
this.updateWaveLabel();
|
|
|
-
|
|
|
- console.log('[EnemyController] 重置到初始状态完成');
|
|
|
}
|
|
|
|
|
|
/**
|