public void StartNewGame() { _spawner.StopSpawning(); _spawner.RemoveSpawnedEnemies(); _spawner.Reset(); _gameModel = new GameModel(); _gameModel.isGameOngoing = true; OnBulletsFiredCountChanged?.Invoke(0); OnBulletsHitCountChanged?.Invoke(0); OnLiveEnemyCountChanged?.Invoke(0); OnDeadEnemyCountChanged?.Invoke(0); _player.enabled = true; _player.Setup(); ShowCursor(false); _hud.ShowHUD(true); _spawner.StartSpawning(); OnGameStart?.Invoke(); Time.timeScale = 1f; }
private void HandleEnemyRemoved(EnemyInfo info) { UpdateStats(info); OnLiveEnemyCountChanged?.Invoke(_gameModel.liveEnemyCount); OnDeadEnemyCountChanged?.Invoke(_gameModel.deadEnemyCount); if (info.affectedEnemyType == EnemyType.Titan && _gameModel.isGameOver == GameResult.None) { _gameModel.isGameOver = GameResult.PlayerWon; OnGameOver?.Invoke(GameResult.PlayerWon); } }
private void HandleEnemySpawned(EnemyInfo info) { UpdateStats(info); OnLiveEnemyCountChanged?.Invoke(_gameModel.liveEnemyCount); }