| | |
| | | public event Action WaveCompleted; |
| | | |
| | | /// <summary> |
| | | /// 有新的敌人生成 |
| | | /// </summary> |
| | | public event Action SpawnNewAgent; |
| | | |
| | | /// <summary> |
| | | /// 波次发生改变 |
| | | /// </summary> |
| | | public event Action WaveChanged; |
| | |
| | | spawnedEnemies = 0; |
| | | |
| | | SpawnCurrent(); |
| | | spawnTimer = new RepeatingTimer(data.Config.interval / 3000f, SpawnCurrent); |
| | | spawnTimer = new RepeatingTimer(data.Config.interval / 1000f, SpawnCurrent); |
| | | StartTimer(spawnTimer); |
| | | } |
| | | |
| | |
| | | isWaveStoped = true; |
| | | } |
| | | |
| | | public void PauseWave() |
| | | { |
| | | PauseTimer(spawnTimer); |
| | | isWaveStoped = true; |
| | | } |
| | | |
| | | public void RestartWave() |
| | | { |
| | | StartTimer(spawnTimer); |
| | | isWaveStoped = false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Handles spawning the current agent and sets up the next agent for spawning |
| | | /// 在场景内孵化出来一个Boss,这个核心函数最后被规则性的数据接管 |
| | | /// </summary> |
| | | protected virtual void SpawnCurrent() |
| | | { |
| | | if (isWaveStoped) |
| | | return; |
| | | if (isWaveStoped) return; |
| | | |
| | | if (!TrySetupNextSpawn()) |
| | | { |
| | |
| | | SafelyBroadcastWaveCompletedEvent(); |
| | | } |
| | | else |
| | | { |
| | | ++spawnedEnemies; |
| | | if (SpawnNewAgent != null) |
| | | SpawnNewAgent(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |