Пример #1
0
 public void AddWorker()
 {
     if (sources.Count > 0)
     {
         ProductionSource s = sources.Find(p => !p.isAtCapacity);
         if (s != null)
         {
             s.AddWorker();
         }
     }
 }
Пример #2
0
 /// <summary>
 ///     If the <paramref name="key" /> exists in the provided <paramref name="dict" />, it will add the
 ///     <paramref name="value" /> to the <paramref name="dict" />'s current value.
 ///     If it does not exist, it will create a new entry in the <paramref name="dict" /> for the supplied
 ///     <paramref name="key" /> with the provided <paramref name="value" />
 /// </summary>
 /// <param name="dict">The Dictionary to add or increment the value for</param>
 /// <param name="key">The specified Key to check or create</param>
 /// <param name="value">The value to add to the dictionary</param>
 static void IncrementOrAddToDictionary(IDictionary <ProductionSource, double> dict, ProductionSource key, double value)
 {
     if (dict.ContainsKey(key))
     {
         dict[key] = dict[key] + value;
     }
     else
     {
         dict.Add(key, value);
     }
 }