inventory

This commit is contained in:
dhain 2022-05-19 16:44:53 +02:00
parent d2c90c3b7f
commit 66eb5af0bb
2 changed files with 74 additions and 1 deletions

View file

@ -14,14 +14,20 @@ public class InventoryUI : MonoBehaviour {
_inventory.onItemChangedCallback += UpdateUI;
_slots = itemsParent.GetComponentsInChildren<InventorySlot>();
toggleInventory();
}
// Update is called once per frame
void Update() {
if(Input.GetButtonDown("Inventory")) {
inventoryUI.SetActive(!inventoryUI.activeSelf);
toggleInventory();
}
}
private void toggleInventory() {
inventoryUI.SetActive(!inventoryUI.activeSelf);
}
private void UpdateUI() {
for(int i = 0; i < _slots.Length; i++) {