private void BuildBuildingOption(BuildingSlot bs) { //Create the UI: GameObject panelBuildingDetails = (GameObject)Instantiate(panelBuildingDetailsPrefab); panelBuildingDetails.transform.SetParent(content.transform); BuildingOption buildingOption = panelBuildingDetails.GetComponent <BuildingOption>(); //Get the BuildingOption script and set Gameplay values: buildingOption.buildingSlotInfos = bs; buildingOption.setBuildingName(bs.Name); buildingOption.setBuildingSprite(Resources.Load <Sprite>(bs.Image)); int numberOfResourcesNeedeed = bs.Resources.Resource.Count; for (int i = 0; i < numberOfResourcesNeedeed; i++) { GameObject panelResourcesNeededGo = panelResourcesNeededGo = (GameObject)Instantiate(panelResourcesNeedeedPrefab); panelResourcesNeededGo.transform.SetParent(panelBuildingDetails.transform); panelResourcesNeededGo.transform.localPosition = new Vector2(200 + (i * 80), -20); buildingOption.addPanelResourcesNeeded(panelResourcesNeededGo.GetComponent <PanelResourceNeeded>()); BuildingResource br = bs.Resources.Resource[i]; buildingOption.addResource((UsableObject)Activator.CreateInstance(Type.GetType(br.Text), 4), Convert.ToInt32(br.Quantity)); } //Populate the UI: buildingOption.populateUI(); }
// the resource is empty // remove it from the world internal void RemoveResource(BuildingResource buildingResource) { _resourcesAtBase.Remove(buildingResource); new BuildingResourceUpdatedEvent { Resource = buildingResource }.Publish(); }
internal void OrderResourceShipment(string resource) { var order = new BuildingResource(resource, 20); order.ReserveResourceBySystem(); _resourcesOrdered.Add(order); IoC.Get <ShipmentController>().OrderResourceShipment(order); }
public static Job CreateDeliveryJob(BuildingResource resource, Tile from, Tile to) { return(new Job(to) { Type = JobType.Delivery, Tag = from, Delivery = resource }); }
internal void TakeResource(BuildingResource resource) { Log($"{resource.Type} @ {resource.Tile.Position}"); resource.TakeResource(); if (resource.IsDepleted) { Log("resource is depleted"); IoC.Get <World>().GetInventory().RemoveResource(resource); resource.Tile.ResourcePile = null; _occupiedTiles.Remove(resource.Tile); _unoccupiedTiles.Add(resource.Tile); new BuildingResourceUpdatedEvent { Resource = resource }.Publish(); } }
public void PickUpResource(BuildingResource resource) { _waitingOnPickup.Remove(resource); Deliveries[_waitingOnPickup.Count].SetActive(false); }
// Order a resource shipment from earth public void OrderResourceShipment(BuildingResource resource) { // Order resource shipment _shipmentRequest.Enqueue(resource); }
public void ScheduleDelivery(BuildingResource resource, Tile from, Tile to) { var delivery = Job.CreateDeliveryJob(resource, from, to); IoC.Get <World>().ScheduleJob(delivery); }
public void AddOrderResourceToInventory(BuildingResource resource) { _resourcesOrdered.Remove(resource); _resourcesAtBase.Add(resource); }