示例#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);
 }