void GetTypeByProfile(CommodityProfile _profile) { if (_profile.components.Count > 0) { foreach (CommodityProfile component in _profile.components) { GetTypeByProfile(component); } } else { int value = _profile.isDurable ? _profile.valuePerUse : _profile.exchangeValue; if (_profile.type == CommoditiesService.instance.workforce) { SpawnCoins(CoinType.Salary, value); } else if (_profile.type == CommoditiesService.instance.plusValue) { SpawnCoins(CoinType.Profit, value); } else { SpawnCoins(CoinType.Material, value); } } }
void GetValueFromCommodity(CommodityProfile _profile) { if (_profile.components.Count == 0) { tempProfiles.Add(_profile); } else { for (var i = 0; i < _profile.components.Count; i++) { GetValueFromCommodity(_profile.components[i]); } } }
public CommodityProfile(CommodityProfile _profile) { type = _profile.type; commodityName = _profile.commodityName; exchangeValue = _profile.exchangeValue; useValue = _profile.useValue; useValueDescription = _profile.useValueDescription; isDurable = _profile.isDurable; usesAmount = _profile.usesAmount; valuePerUse = _profile.valuePerUse; components = _profile.components; icon = _profile.icon; sizeModifier = _profile.sizeModifier; color = _profile.color; components = _profile.components; }