private void UpdateSpecialResources() { XYield totalSpecial = new XYield(); var specialResources = Composition.GetPlanetData().Select(pd => pd.SpecialResources); if (!specialResources.IsNullOrEmpty()) { var totalSpecialFromPlanets = specialResources.Aggregate<XYield>( (accumulator, x) => new XYield() { // Aggregate throws up if source enumerable is empty Special_1 = accumulator.Special_1 + x.Special_1, Special_2 = accumulator.Special_2 + x.Special_2, Special_3 = accumulator.Special_3 + x.Special_3 }); totalSpecial.Add(totalSpecialFromPlanets); } totalSpecial.Add(Composition.StarData.SpecialResources); SpecialResources = totalSpecial; }
public void Add(XYield other) { Special_1 += other.Special_1; Special_2 += other.Special_2; Special_3 += other.Special_3; }