예제 #1
0
    private void Reset()
    {
        for (int i = 0; i < _zombieGameObjects.Count; i++)
        {
            var zombie = _zombieGameObjects[i];
            zombie.Reset();
            _pool.ReturnZombieController(zombie);
            _pool.ReturnZombieModel(zombie.Model);
        }

        _mapData.Reset();
        _aliveCount = 0;
        _zombieGameObjects.Clear();
        StartPhysicsForceTimer();
    }
예제 #2
0
    private void OnZombieDied(ZombieController controller, Zombie zombie)
    {
        if (zombie.IsBoss)
        {
            _lastBossAlive = false;
        }

        if (_zombies.Contains(zombie))
        {
            _zombies.Remove(zombie);
            _zombiePool.ReturnZombieModel(zombie);
        }

        int nextWave = WaveNumber + 1;

        if (nextWave == _gameConfig.waveSettings.firstBossWaveNumber && _tutorialManager.IsTutorialEnabled)
        {
            if (_zombies.Count == 0)
            {
                _waveStarted      = false;
                _autoStartNewWave = false;
                _tutorialManager.StartHandDDTutorial();
            }

            SetDirty();
            return;
        }

        if (_tutorialManager.IsTutorialWave)
        {
            if (_zombies.Count == 0)
            {
                _waveStarted = false;
                _tutorialManager.CompleteTutorialStep(_tutorialManager.ActiveTutorialStep.Action);
            }

            SetDirty();
            return;
        }

        _onUpdateZombiesCountSignal.Fire(_zombies.Count);
        if (_nightManager.IsNightActive)
        {
            if (_zombies.Count == 0)
            {
                _windowsManager.ShowWindow <NightEndWindow>();
            }

            return;
        }

        if (!_autoStartNewWave)
        {
            return;
        }

        if (_zombies.Count <= _gameConfig.waveSettings.zombiesToStartNewWave)
        {
            StartNewWave();
        }

        SetDirty();
    }