public bool RequiresWorkshopMaterial(float workshopMaterialID) { WoodshopMaterialCount wsm = RequiredMaterials.Find(x => x.MaterialID == workshopMaterialID); bool found = (wsm != null); return(found); }
public void RemoveMaterialRequirement(float workshopMaterialID) { if (RequiresWorkshopMaterial(workshopMaterialID)) { WoodshopMaterialCount m = RequiredMaterials.Find(x => x.MaterialID == workshopMaterialID); RequiredMaterials.Remove(m); } }
public void AddMaterialRequirement(float workshopMaterialID, int amountRequired) { WoodshopMaterialCount newCount = new WoodshopMaterialCount { MaterialID = workshopMaterialID, Amount = amountRequired }; if (RequiresWorkshopMaterial(workshopMaterialID)) { WoodshopMaterialCount currentCount = RequiredMaterials.Find(x => x.MaterialID == workshopMaterialID); int index = RequiredMaterials.IndexOf(currentCount); RequiredMaterials.Insert(index, newCount); } else { RequiredMaterials.Add(newCount); } }