Ejemplo n.º 1
0
    private InfInt CalculateWaveHP(int dozen, int one, bool beforeFirstBoss)
    {
        _tempBigNumber.Set(1);
        for (int i = 0; i < dozen; i++)
        {
            _tempBigNumber.Multiply(_gameConfig.waveSettings.bossHPMultiplier);
        }

        if (beforeFirstBoss)
        {
            _tempBigNumber.Multiply(_gameConfig.waveSettings.firstWaveHP);
        }
        else
        {
            _tempBigNumber.Multiply(_gameConfig.waveSettings.firstBossHP);
        }

        _tmpBigNumber.Set(0);
        if (one > 1)
        {
            _tmpBigNumber.Set(_tempBigNumber);
            _tmpBigNumber.Multiply(one - 1);
            _tmpBigNumber.MultiplyInPercents(_gameConfig.waveSettings.waveMultiplier);
        }

        _tempBigNumber.Add(_tmpBigNumber);
        return(_tempBigNumber);
    }
Ejemplo n.º 2
0
    private void CalculateWaveHP(WaveType waveType)
    {
        if (_tutorialManager.ActiveTutorialStep.Action == TutorialAction.FirstWave || _tutorialManager.ActiveTutorialStep.Action == TutorialAction.SecondWave)
        {
            TutorialWaveSettings waveSettings = _tutorialManager.GetWave();
            _currentWaveHP.Set(waveSettings.waveHP);
            _currentZombieCount       = waveSettings.zombieCount;
            _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
            _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP);
            return;
        }

        if (_tutorialManager.ActiveTutorialStep.Action == TutorialAction.ThirdWave || (WaveNumber == 1 && !_tutorialManager.IsTutorialEnabled))
        {
            _currentZombieCount       = _gameConfig.waveSettings.startZombieCount;
            _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
            _currentWaveHP.Set(_gameConfig.waveSettings.firstWaveHP);
            _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP);
            return;
        }

        int firstBossWaveNumber = _gameConfig.waveSettings.firstBossWaveNumber;

        switch (waveType)
        {
        case WaveType.Boss:
            // босс волна
            _zombieCountBeforeBoss = _currentZombieCount;
            _currentZombieCount    = 1;  // босс всегда приходит один

            if (WaveNumber == firstBossWaveNumber)
            {
                _currentWaveHP.Set(_gameConfig.waveSettings.firstBossHP);
            }
            else
            {
                _currentWaveHP.Set(_currentDecadeStartHP);
                _currentWaveHP.Multiply(_gameConfig.waveSettings.bossHPMultiplier);
            }
            Debug.Log("BOSS wave = " + WaveNumber.ToString() + "; wave HP = " + _currentWaveHP.ToFullString() + "; zombie count = " + _currentZombieCount.ToString());
            break;

        case WaveType.AfterBoss:
            _currentZombieCount       = _zombieCountBeforeBoss;
            _currentDecadeZombieCount = _currentZombieCount;
            _currentDecadeStartHP.Set(_currentWaveHP);
            Debug.Log("AFTER BOSS wave = " + WaveNumber.ToString() + "; wave HP = " + _currentWaveHP.ToFullString() + "; zombie count = " + _currentZombieCount.ToString());
            break;

        case WaveType.Test:
            _currentWaveHP.Set(_gameConfig.waveSettings.firstWaveHP);
            _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP);
            _zombieCountBeforeBoss    = _gameConfig.waveSettings.startZombieCount;
            _currentZombieCount       = _zombieCountBeforeBoss;
            _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
            WaveNumber = _gameConfig.waveSettings.startWave;
            Debug.Log("TEST WAVE!");
            break;

        case WaveType.TestBoss:
            _currentWaveHP.Set(_gameConfig.waveSettings.firstWaveHP);
            _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP);
            _zombieCountBeforeBoss    = _gameConfig.waveSettings.startZombieCount;
            _currentZombieCount       = 1;
            _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
            WaveNumber = _gameConfig.waveSettings.startWave;
            Debug.Log("TEST BOSS WAVE!");
            break;

        default:
            Debug.Log("prev wave hp = " + _currentWaveHP.ToString());

            _tempBigNumber.Set(_currentDecadeStartHP);
            _tempBigNumber.MultiplyInPercents(_gameConfig.waveSettings.waveMultiplier);

            Debug.Log("temp big number = " + _tempBigNumber.ToString());

            _currentWaveHP.Add(_tempBigNumber);

            Debug.Log("simple wave = " + WaveNumber.ToString() + "; wave HP = " + _currentWaveHP.ToFullString() + "; zombie count = " + _currentZombieCount.ToString());
            break;
        }
    }