void HeldItem() { Sprite item = inventorySlot.GetSprite(); // if (item == null) // itemSprite.color = Color.clear; // else // itemSprite.color = Color.white; // // itemSprite.sprite = item; }
// Update the ui of this slot to match whatever is specified. public void UpdateUITo(ItemType itemType) { if (itemType == null) { image.sprite = defaultSprite; } else { image.sprite = itemType.GetSprite(); } }
public void AddSlot(ItemType itemType) { // Instantiate an item slot. GameObject slot = Instantiate(itemSlotPrefab); // Tag it as an inventory slot. slot.tag = "InventorySlot"; // Add it to the dictionary. slots.Add(itemType, slot); slotItemTypes.Add(slot, itemType); // Set its parent. slot.transform.SetParent(inventoryGO.transform); // Set the item image. slot.GetComponent <Image> ().sprite = itemType.GetSprite(); // Set the text. slot.transform.GetChild(0).GetComponent <Text> ().text = "1"; // Set the item type for the mouse over. slot.GetComponent <InspectorItemMouseOver> ().item = itemType; }
void Start() { rend.sprite = type.GetSprite(); }