Exemplo n.º 1
0
        private void TryUpgradeAutomation(Action <bool> upgradeResult)
        {
            var result = IsEnoughMoneyToUpgrade();

            upgradeResult?.Invoke(result);
            if (result == false)
            {
                return;
            }

            _playerData.Gold -= _automationData.CurrentCost;
            _automation.Upgrade(_automationData, _automationsData);
            if (_automationData.Level % LevelToGetPoint == 0)
            {
                _playerData.BadgePoints += PointsIncrease;
            }
        }
 public void TryUpgradeAutomation(int automationId, IAutomation automation, UnityEvent automationUpgraded)
 {
     if (_playerData.Gold >= _automation.CurrentCost)
     {
         _playerData.Gold -= _automation.CurrentCost;
         automation.Upgrade(_automation, _automationsData);
         if (_automation.Level % 2000 == 0)
         {
             _playerData.BadgePoints += 1;
         }
         automationUpgraded?.Invoke();
         _automationOutput.AutomationUpgraded(_automation, _playerData.Gold >= _automation.CurrentCost);
     }
     else
     {
         _automationOutput.AutomationNotUpgraded();
     }
 }