public void AddValue(Cultivation cultivation, Cultivation oldCultivation, CultivationPrefab cultivationPrefab) { if (!SimpleMoneyManager.Instance.EnoughMoney(cultivation.BuildPrice)) { return; } SimpleMoneyManager.Instance.RemoveMoney(cultivation.BuildPrice); if (cultivation.MyCultivationState == NodeState.CurrentStateEnum.EmptyField) { return; } SimpleMoneyManager.Instance.AddFinance(cultivation, oldCultivation != null ? oldCultivation.MonthCount : 0); _moneyValueTracker++; if (_moneyValueTracker == _moneyValueCount) { SimpleMoneyManager.Instance.SetPercentageValues(SaveManager.Instance.GetPercentageValues()); TimeManager.Instance.CalculateMoney(); } else if (cultivation.Upgrade) { AddUpgradedCultivation(cultivationPrefab); if (cultivationPrefab.MyCurrentState == NodeState.CurrentStateEnum.Farm) { ((BuildingPrefab)cultivationPrefab).MyBuilding.UpgradeDuration = cultivationPrefab.UpgradeDuration; } else if (cultivationPrefab.MyCurrentState == NodeState.CurrentStateEnum.Field) { ((PlantPrefab)cultivationPrefab).MyPlant.UpgradeDuration = cultivationPrefab.UpgradeDuration; } } }
// ReSharper disable once SuggestBaseTypeForParameter public void RemoveUpgradedCultivation(CultivationPrefab cultivationPrefab) { _activeUpgradedCultivations.RemoveAll ( c => _activeUpgradedCultivations.Any ( c2 => c2.MyCultivationPrefab == cultivationPrefab ) ); }
public CultivationPrefabList(CultivationPrefab myCultivationPrefab) { MyCultivationPrefab = myCultivationPrefab; }
public void AddUpgradedCultivation(CultivationPrefab cultivationPrefab) { _activeUpgradedCultivations.Add(new CultivationPrefabList(cultivationPrefab)); }