Esempio n. 1
0
 private void UpdateResources() {
     OpeYield totalResource = new OpeYield();
     var resources = Composition.GetPlanetData().Select(pd => pd.Resources);
     if (!resources.IsNullOrEmpty()) {   // Aggregate throws up if source enumerable is empty
         var totalResourceFromPlanets = resources.Aggregate<OpeYield>(
             (accumulator, ope) => new OpeYield() {
                 Organics = accumulator.Organics + ope.Organics,
                 Particulates = accumulator.Particulates + ope.Particulates,
                 Energy = accumulator.Energy + ope.Energy
             });
         totalResource.Add(totalResourceFromPlanets);
     }
     totalResource.Add(Composition.StarData.Resources);
     Resources = totalResource;
 }
Esempio n. 2
0
 public void Add(OpeYield other) {
     Organics += other.Organics;
     Particulates += other.Particulates;
     Energy += other.Energy;
 }