public double Evaluate(MultiWaveStatistics statistics) { throw new NotImplementedException(); }
internal void Calculate() { Calculator calculator = new Calculator(Options.Instance.Rounds); //unist, counts, general, enemy units, counts, generals MultiWaveBattle battle = new MultiWaveBattle(Options.Instance.Rounds); battle.BattleType = Options.Instance.MultiWaveBattleType; battle.StatisticsType = StatisticsType.All; bool isEnemyEmpty = true; bool isAttackerEmpty = true; for (int i = 0; i < MAX_WAVES_COUNT; i++) { battle.AddAttackerWave(PlayerWaves[i], m_playerGenerals[i], m_playerTowerBonus[i]); battle.AddEnemyWave(EnemyWaves[i], null, m_enemyTowerBonus[i], m_enemyCampDestroyTime[i]); if (isAttackerEmpty) { foreach (UnitSquad squad in PlayerWaves[i]) { if (squad.Count > 0) { isAttackerEmpty = false; } } } if (isEnemyEmpty) { foreach (UnitSquad squad in EnemyWaves[i]) { if (squad.Count > 0) { isEnemyEmpty = false; } } } } if (isEnemyEmpty || isAttackerEmpty) { Simulation = null; m_totalLosses = null; m_waveLosses.Clear(); OnPropertyChanged("TotalLosses"); OnPropertyChanged("WaveLosses"); return; } MultiWaveStatistics statistics = new MultiWaveStatistics(battle); battle.OnBattleComplete += statistics.MultiWaveBattleCompleteHandler; battle.OnWaveComplete += statistics.MultiWaveBattleWaveCompleteHandler; MultyWaveBattleSimulation simulation = new MultyWaveBattleSimulation(); battle.OnBattleComplete += simulation.MultiWaveBattleCompleteHandler; battle.OnWaveComplete += simulation.MultiWaveBattleWaveCompleteHandler; battle.Calculate(calculator); battle.OnBattleComplete -= statistics.MultiWaveBattleCompleteHandler; battle.OnWaveComplete -= statistics.MultiWaveBattleWaveCompleteHandler; battle.OnBattleComplete -= simulation.MultiWaveBattleCompleteHandler; battle.OnWaveComplete -= simulation.MultiWaveBattleWaveCompleteHandler; statistics.Calculate(); m_totalLosses = GenerateBattleLosses(statistics.TotalStatistics, battle); m_waveLosses.Clear(); foreach (KeyValuePair <WaveKey, Statistics.Statistics> pair in statistics.Statistics) { BattleLosses waveLosses = GenerateBattleLosses(pair.Value, pair.Value.Battle); waveLosses.PlayerWaveIndex = pair.Key.AttackerWave + 1; waveLosses.EnemyWaveIndex = pair.Key.DefenderWave + 1; m_waveLosses.Add(waveLosses); } OnPropertyChanged("TotalLosses"); OnPropertyChanged("WaveLosses"); if (simulation.Simulations.Count == 0) { simulation = null; } Simulation = simulation; }