Exemple #1
0
    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;
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
 private void HandleEnemySpawned(EnemyInfo info)
 {
     UpdateStats(info);
     OnLiveEnemyCountChanged?.Invoke(_gameModel.liveEnemyCount);
 }