コード例 #1
0
 public void SetCurrentResource(Dictionary <int, float> resources)
 {
     foreach (var item in resources)
     {
         SingleResourceComponent singleResourceComponent = GetSingleResourceComponentById(item.Key);
         if (singleResourceComponent == null)
         {
             continue;
         }
         singleResourceComponent.SetPoint(item.Value);
     }
 }
コード例 #2
0
 public bool TryToAford(Dictionary <int, float> resources)
 {
     if (CanAford(resources))
     {
         foreach (var item in resources)
         {
             SingleResourceComponent singleResourceComponent = GetSingleResourceComponentById(item.Key);
             singleResourceComponent.LosePoint(null, item.Value);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
 public bool CanAford(Dictionary <int, float> resources)
 {
     foreach (var item in resources)
     {
         SingleResourceComponent singleResourceComponent = GetSingleResourceComponentById(item.Key);
         if (singleResourceComponent == null)
         {
             return(false);
         }
         if (singleResourceComponent.point < item.Value)
         {
             return(false);
         }
     }
     return(true);
 }