public override void Initialize(GameEntity entity) { if (RessourceConsumption.Find(item => item.RessourceToUse.name == "Energy") != null) { EnergyConsumption = RessourceConsumption.Find(item => item.RessourceToUse.name == "Energy").Amount; } else { EnergyConsumption = 0; } switch (RessourceProduced) { case RessourceType.Carburant: entity.CarburantProduction += RetrievingAmount; break; case RessourceType.RawMaterials: entity.RawMaterialsProduction += RetrievingAmount; break; case RessourceType.Water: entity.WaterProduction += RetrievingAmount; break; } if (RessourceConsumption != null) { foreach (var obj in RessourceConsumption) { obj.RessourceToUse.ComputeConsommation(entity, obj.Amount); } } }
public override void Initialize(GameEntity entity) { if (RessourceConsumption.Find(item => item.RessourceToUse.name == "Energy") != null) { EnergyConsumption = RessourceConsumption.Find(item => item.RessourceToUse.name == "Energy").Amount; } else { EnergyConsumption = 0; } foreach (var obj in RessourceConsumption) { obj.RessourceToUse.ComputeConsommation(entity, obj.Amount); } }
public override void Initialize(GameEntity entity) { if (RessourceConsumption.Find(item => item.RessourceToUse.name == "Energy") != null) { EnergyConsumption = RessourceConsumption.Find(item => item.RessourceToUse.name == "Energy").Amount; } else { EnergyConsumption = 0; } switch (RessourceProduced) { case RessourceType.Energy: entity.EnergyProduction += ProductionAmount; break; case RessourceType.Food: entity.FoodProduction += ProductionAmount; break; case RessourceType.ConstructionMaterials: entity.ConstructionMaterialsProduction += ProductionAmount; break; default: Debug.Log("Caca"); break; } if (RessourceConsumption != null) { foreach (var obj in RessourceConsumption) { obj.RessourceToUse.ComputeConsommation(entity, obj.Amount); } } }