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); } }
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); } }
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); }