private void ResourcePackageStartedMoving(ResourcePackage providedResourcePackage) { ProvidedResourceList.Remove(providedResourcePackage); if (ProvidedResourceList.Count == 0) { AllProvisionsLeft?.Invoke(this); } }
public void UpdateProvisionPriority(ResourcePackage resourcePackage, RequestPriority priority) { var provisions = Provisions.ToArray(); foreach (var provision in provisions) { if (provision == resourcePackage) { Provisions.UpdatePriority(provision, priority); } } }
public void UpdateRequestPriority(ResourcePackage resourcePackage, RequestPriority priority) { var requests = Requests.ToArray(); foreach (var request in requests) { if (request == resourcePackage) { Requests.UpdatePriority(request, priority); } } }
public ResourcePackage RequestResource(Structure requestingStructure, ResourceType resourceType, RequestPriority priority) { var providedPackage = Provisions.Dequeue(resourceType, rp => HasPathFilter(rp.StartStructure, requestingStructure)); if (providedPackage != null) { providedPackage.DestinationStructure = requestingStructure; providedPackage.SpecifyResourceType(resourceType); providedPackage.Move(); return(providedPackage); } var resourcePackage = new ResourcePackage(resourceType, World.PathFinder, World.GameSettings.GameplaySettings) { DestinationStructure = requestingStructure }; AddPackage(resourcePackage); Requests.Enqueue(resourcePackage, priority); return(resourcePackage); }
private void ResourcePackage_StartedMoving(ResourcePackage resourcePackage) { PackageStarted?.Invoke(this, resourcePackage); }
private void ResourcePackage_ArrivedAtDestination(ResourcePackage resourcePackage) { PackageArrived?.Invoke(this, resourcePackage); AllPackageList.Remove(resourcePackage); }
private void AddPackage(ResourcePackage resourcePackage) { AllPackageList.Add(resourcePackage); resourcePackage.StartedMoving += ResourcePackage_StartedMoving; resourcePackage.ArrivedAtDestination += ResourcePackage_ArrivedAtDestination; }
public void ResourcePassesThrough(ResourcePackage resourcePackage) { }
public void ResourceArrived(ResourcePackage resourcePackage) { RequestedNetworkResourceList.Remove(resourcePackage); ArrivedResourceList.Add(resourcePackage.ResourceType); NewResourceAvailable(); }
/// <summary> /// Get's called everytime a Resource passes the Node the Building is located at. /// </summary> /// <param name="resource">The Resource that passes through.</param> public virtual void OnResourcePassesThrough(ResourcePackage resource) { ResourceDirector.ResourcePassesThrough(resource); }
/// <summary> /// Get's called everytime a Resource arrives which destination was this Building. /// </summary> /// <param name="resource">The Resource that arrived.</param> public void OnResourceArrived(ResourcePackage resource) { ResourceDirector.ResourceArrived(resource); }