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 HandleShotFired(ShotInfo info) { _gameModel.bulletsFiredCount += info.bulletsFired; _gameModel.bulletsHitcount += info.bulletsHit; OnBulletsFiredCountChanged?.Invoke(_gameModel.bulletsFiredCount); if (info.bulletsHit > 0) { OnBulletsHitCountChanged?.Invoke(_gameModel.bulletsHitcount); } }