Пример #1
0
 private void TakeAwayResourcesRoad(Road road)
 {
     for (int i = 0; i < _amountNeedResource; i++)
     {
         ResourceForConstruction resource     = road.ResourcesForConstruction[i];
         ResourcesData           needRecource = _resources.resourcesData[_resources.FindIndexResourceInList(resource.ResourceType)];
         needRecource.ChangeAmountResource.Invoke(resource.ResourceType, -resource.CostConstruction);
     }
 }
Пример #2
0
 private void TakeAwayResources(Building building)
 {
     for (int i = 0; i < _amountNeedResource; i++)
     {
         ResourceForConstruction resource     = building.LevelsData[building.CurrentLevel].resourcesForConstruction[i];
         ResourcesData           needRecource = _resources.resourcesData[_resources.FindIndexResourceInList(resource.ResourceType)];
         needRecource.ChangeAmountResource.Invoke(resource.ResourceType, -resource.CostConstruction);
     }
 }
Пример #3
0
 private bool CheckAllNeedResourse(Building building)
 {
     _amountNeedResource = building.LevelsData[building.CurrentLevel].resourcesForConstruction.Count;
     for (int i = 0; i < _amountNeedResource; i++)
     {
         ResourceForConstruction resource = building.LevelsData[building.CurrentLevel].resourcesForConstruction[i];
         if (!CheckAmountResource(resource.ResourceType, resource.CostConstruction))
         {
             return(false);
         }
     }
     return(true);
 }
Пример #4
0
 // написать перегрузку методов
 private bool CheckAllNeedResourseRoad(Road road)
 {
     _amountNeedResource = road.ResourcesForConstruction.Count;
     for (int i = 0; i < _amountNeedResource; i++)
     {
         ResourceForConstruction resource = road.ResourcesForConstruction[i];
         if (!CheckAmountResource(resource.ResourceType, resource.CostConstruction))
         {
             return(false);
         }
     }
     return(true);
 }