|
|
@@ -95,9 +95,9 @@ export class EnemyController extends BaseSingleton {
|
|
|
|
|
|
@property({
|
|
|
type: Node,
|
|
|
- tooltip: '下一波提示UI节点 (NextWaveUI)'
|
|
|
+ tooltip: '每波开始提示UI节点 (StartWaveUI)'
|
|
|
})
|
|
|
- public nextWaveUI: Node = null;
|
|
|
+ public startWaveUI: Node = null;
|
|
|
|
|
|
private totalWaves: number = 1;
|
|
|
private currentWave: number = 1;
|
|
|
@@ -146,8 +146,8 @@ export class EnemyController extends BaseSingleton {
|
|
|
if (!this.waveNumberLabelNode) {
|
|
|
this.waveNumberLabelNode = find('Canvas/GameLevelUI/WaveInfo/WaveNumber');
|
|
|
}
|
|
|
- if (!this.nextWaveUI) {
|
|
|
- this.nextWaveUI = find('Canvas/GameLevelUI/NextWaveUI');
|
|
|
+ if (!this.startWaveUI) {
|
|
|
+ this.startWaveUI = find('Canvas/GameLevelUI/StartWaveUI') || find('Canvas/GameLevelUI/NextWaveUI');
|
|
|
}
|
|
|
// 初始化敌人数量显示
|
|
|
this.updateEnemyCountLabel();
|
|
|
@@ -570,7 +570,7 @@ export class EnemyController extends BaseSingleton {
|
|
|
this.currentWaveEnemiesKilled = 0;
|
|
|
this.updateWaveLabel();
|
|
|
this.updateEnemyCountLabel();
|
|
|
- if (this.nextWaveUI) this.nextWaveUI.active = false;
|
|
|
+ if (this.startWaveUI) this.startWaveUI.active = false;
|
|
|
}
|
|
|
|
|
|
private updateWaveLabel() {
|
|
|
@@ -581,13 +581,20 @@ export class EnemyController extends BaseSingleton {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public showNextWavePromptUI(duration: number = 2) {
|
|
|
- if (!this.nextWaveUI) return;
|
|
|
- this.nextWaveUI.active = true;
|
|
|
+ /** 显示每波开始提示,随后开启敌人生成 */
|
|
|
+ public showStartWavePromptUI(duration: number = 2) {
|
|
|
+ if (!this.startWaveUI) return;
|
|
|
+ this.startWaveUI.active = true;
|
|
|
+ // 暂停生成(确保未重复)
|
|
|
+ this.pauseSpawning();
|
|
|
if (duration > 0) {
|
|
|
this.scheduleOnce(() => {
|
|
|
- if (this.nextWaveUI) this.nextWaveUI.active = false;
|
|
|
+ if (this.startWaveUI) this.startWaveUI.active = false;
|
|
|
+ // 真正开始/恢复生成敌人
|
|
|
+ this.startGame();
|
|
|
}, duration);
|
|
|
+ } else {
|
|
|
+ this.startGame();
|
|
|
}
|
|
|
}
|
|
|
}
|