Exemple #1
0
    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);
        }
    }
Exemple #2
0
    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);
        }
    }