示例#1
0
 public SurfaceComposition GetCombinedComposition()
 {
     var sc = new SurfaceComposition();
     foreach (var city in Cities)
     {
         sc = sc + city.surfaceComposition;
     }
     return sc;
 }
示例#2
0
        public static SurfaceComposition operator +(SurfaceComposition lhs, SurfaceComposition rhs)
        {
            var v = new SurfaceComposition();
            v.composition.AddRange(lhs.composition);
            var extra = new List<Chemical>();
            foreach (var c in v.composition)
            {
                foreach (var rc in rhs.composition)
                {
                    if (c.name == rc.name)
                    {
                        c.percentage = (c.percentage + rc.percentage)/2;
                    }
                    else
                    {
                        extra.Add(rc);
                    }
                }
            }

            v.composition.AddRange(extra);

            return v;
        }
示例#3
0
 public City()
 {
     surfaceComposition = new SurfaceComposition();
 }