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:
parent
433158e658
commit
aacdd80fdf
103 changed files with 17775 additions and 58 deletions
30
Assets/Scripts/InventorySlot.cs
Normal file
30
Assets/Scripts/InventorySlot.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue