public void Upgrade(Automation automationData, AutomationsData automationsData) { long newDamage = 0; if (automationData.Level != 0) { automationsData.AutomationsPower -= automationData.CurrentDamage; } for (int i = 0; i < automationsData.LevelsToUpgrade; i++) { automationData.Level += 1; newDamage += Mathf.RoundToInt(automationData.StartingDamage * UpgradeFactor * automationData.Level); if (automationData.Level >= 200 && automationData.Level % 25 == 0 && automationData.Level < 4000) { newDamage *= 4; } if (automationData.Level >= 1000 && automationData.Level % 1000 == 0 && automationData.Level < 4000) { newDamage *= 10; } foreach (var item in automationData.UpgradeComponents) { if (item.IsUpgradeComponentPurchased) { newDamage += Mathf.RoundToInt(newDamage * item.Percentage / 100); } } automationData.CurrentDamage = newDamage; } automationsData.AutomationsPower += automationData.CurrentDamage; automationsData.AutomationsPower += Mathf.RoundToInt(automationsData.AutomationsPower * automationsData.AutomationsPowerPercentageIncrease); RecalculateCost(automationsData.LevelsToUpgrade, automationData); }
public UpgradeComponent(PlayerData playerData, AutomationsData automationsData, Automation automationData, UpgradeComponentData upgradeComponentData, IAutomationCommand automationCommand, AutomationUpgradeComponentPresenter skillPresenter) { _upgradeComponentData = upgradeComponentData; _playerData = playerData; AutomationsData = automationsData; AutomationData = automationData; _skillCommand = automationCommand; _skillPresenter = skillPresenter; Subscribe(); }