mirror of
https://github.com/DerTyp7/example-top-down-unity.git
synced 2025-10-31 21:27:07 +01:00
-Added Items
-Added item stacking -adding and removing items
This commit is contained in:
33
Assets/Scripts/Inventory/InventoryController.cs
Normal file
33
Assets/Scripts/Inventory/InventoryController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class InventoryController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Item item1;// not needed
|
||||
[SerializeField] Item item2;// not needed
|
||||
public Inventory inventory;
|
||||
[SerializeField] UI_Inventory uiInventory;
|
||||
private void Awake()
|
||||
{
|
||||
inventory = transform.GetComponent<Inventory>();
|
||||
inventory.createEmptyInventory(5);
|
||||
Debug.Log(inventory.addItemAt(0, item1, 8));
|
||||
Debug.Log(inventory.addItemAt(0, item1, 1));
|
||||
Debug.Log(inventory.addItemAt(3, item2, 15));
|
||||
Debug.Log(inventory.addItemAt(0, item2, 15));
|
||||
Debug.Log(inventory.getInventory[0].Count);
|
||||
|
||||
uiInventory.setInventory(inventory);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user