public bool AddResources(CL_Storage ResourcesToAdd) { if (IsStorageFull()) { if (ResourceList.Count > 0) { foreach (var itemToAdd in ResourcesToAdd.ResourceList) { CL_Resource ResourceFound = ResourceList.Find(f => f.ResourceName == itemToAdd.ResourceName); if (ResourceFound != null) { ResourceFound.AddResource(itemToAdd); continue; } else { ResourceList.Add(itemToAdd); } } } else { ResourceList = ResourcesToAdd.ResourceList; } return(true); } else { return(false); } }
public void AddResource(CL_Resource ResourcePass) { CL_Resource ItemFound = Storage.ResourceList.Find(f => f.ResourceName == ResourcePass.ResourceName); if (ItemFound != null) { ItemFound.AddResource(ResourcePass); return; } else { Storage.ResourceList.Add(ResourcePass); } }