Пример #1
0
 private void ResourcePackageStartedMoving(ResourcePackage providedResourcePackage)
 {
     ProvidedResourceList.Remove(providedResourcePackage);
     if (ProvidedResourceList.Count == 0)
     {
         AllProvisionsLeft?.Invoke(this);
     }
 }
Пример #2
0
 public void ProvideResources(params ResourceTypeSource[] resourceTypes)
 {
     if (ProvidedResourceList.Any())
     {
         throw new InvalidOperationException("Can't provide new Resources until all currently provided resources are on it's way");
     }
     foreach (var resourceType in resourceTypes)
     {
         var resourcePackage = World.ResourceManager.ProvideResource(Structure, resourceType.ResourceType, Priority);
         ProvidedResourceList.Add(resourcePackage);
         if (resourcePackage.ResourceRequestState != ResourceRequestState.Pending)
         {
             ResourcePackageStartedMoving(resourcePackage);
         }
         else
         {
             resourcePackage.StartedMoving += ResourcePackageStartedMoving;
         }
     }
 }