added Inventory UI

added logic to inventory
 * it is very possible to be reworked in the near future
 * With
   - ScriptableItem
   - an own Inventory class maybe
   - if necessary no Dictionary anymore
This commit is contained in:
d-hain 2022-05-19 02:30:21 +02:00
parent 433158e658
commit aacdd80fdf
103 changed files with 17775 additions and 58 deletions

View file

@ -0,0 +1,30 @@
using UnityEngine;
using UnityEngine.UI;
public class InventorySlot : MonoBehaviour {
public Image icon;
private Item item;
public void addItem(Item newItem) {
item = newItem;
icon.sprite = item.defaultSprite;
icon.enabled = true;
}
public void clearSlot() {
item = null;
icon.sprite = null;
icon.enabled = false;
}
public void removeItem() {
PlayerController.instance.inventory.Remove(item);
}
public void useItem() {
//TODO: use item
Debug.Log("using " + item.displayName);
}
}