public void InsertInventoryItem(GatheringController gc, ResourceTypes type, ObjectInfo objectInfo) { GameObject invItem = Instantiate(inventoryItemPrefab); invItem.transform.SetParent(inventoryPanel.transform); invItem.GetComponent <InventoryItem>().AttachResource(gc.heldResources[type], objectInfo); }
public void BindGameObject(GameObject go) { unitSelected = go; unitNameText.text = go.GetComponent <ObjectInfo>().objectName; UpdateHealthPanel(); GatheringController gc = go.GetComponent <GatheringController>(); if (gc != null) { foreach (ResourceTypes type in gc.heldResources.Keys) { InsertInventoryItem(gc, type, go.GetComponent <ObjectInfo>()); } } }