コード例 #1
0
ファイル: Activity.cs プロジェクト: temaperacl/florine
 public virtual void AdjustNutrients(NutrientSet target)
 {
     // Probably should change NutrientSet type to inherit directly or implement IEnumX
     foreach (KeyValuePair <Nutrient, NutrientAmount> kvp in Impact)
     {
         NutrientAmount val = 0;
         target.TryGetValue(kvp.Key, out val);
         target[kvp.Key] = val + kvp.Value;
     }
 }
コード例 #2
0
ファイル: Food.cs プロジェクト: temaperacl/florine
 public void AdjustNutrients(NutrientSet target)
 {
     // Probably should change NutrientSet type to inherit directly or implement IEnumX
     foreach (KeyValuePair <Nutrient, NutrientAmount> kvp in Parent.Nutrients)
     {
         // Switch Dictionary Type to Concurrent?
         NutrientAmount val = 0;
         target.TryGetValue(kvp.Key, out val);
         target[kvp.Key] = val + kvp.Value;
     }
 }
コード例 #3
0
ファイル: Nutrient.cs プロジェクト: temaperacl/florine
 public float RatioRDV(NutrientAmount amount)
 {
     if (DailyTarget == null)
     {
         return(1f);
     }
     if (amount == null)
     {
         return(0f);
     }
     return((float)(amount / DailyTarget));
 }