using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization; namespace Ingvar.LiveWatch.TowerDefenceDemo { public class EconomyConfig : ScriptableObject { public Dictionary MobKillRewards { get { if (_mobRewardsDict != null) return _mobRewardsDict; _mobRewardsDict = new Dictionary(); foreach (var mobKillReward in _mobKillRewards) { _mobRewardsDict.Add(mobKillReward.Type, mobKillReward.GoldReward); } return _mobRewardsDict; } } public Dictionary TowerBuildCosts { get { if (_towerCostsDict != null) return _towerCostsDict; _towerCostsDict = new Dictionary(); foreach (var towerBuildCost in _towerCosts) { _towerCostsDict.Add(towerBuildCost.Type, towerBuildCost.GoldCost); } return _towerCostsDict; } } public Dictionary TowerSellPrices { get { if (_towerSellPricesDict != null) return _towerSellPricesDict; _towerSellPricesDict = new Dictionary(); foreach (var towerBuildCost in _towerCosts) { _towerSellPricesDict.Add(towerBuildCost.Type, towerBuildCost.GoldSellPrice); } return _towerSellPricesDict; } } [SerializeField] private MobRewardSetup[] _mobKillRewards; [SerializeField] private TowerCostSetup[] _towerCosts; private Dictionary _mobRewardsDict; private Dictionary _towerCostsDict; private Dictionary _towerSellPricesDict; [Serializable] private class MobRewardSetup { public MobType Type; public int GoldReward; } [Serializable] private class TowerCostSetup { public TowerType Type; public int GoldCost; public int GoldSellPrice; } } }