can interact if player has tool selected (in hand))

This commit is contained in:
j.mei7
2022-02-18 20:25:35 +01:00
parent 73669eaa3f
commit 3ff90d47c2
30 changed files with 505 additions and 78 deletions

View File

@@ -6,15 +6,20 @@ public class InventoryController : MonoBehaviour
{
[SerializeField] Item item1;// not needed
[SerializeField] Item item2;// not needed
public Item selectedItem;
Item testItem;
public Inventory inventory;
[SerializeField] UI_Inventory uiInventory;
private void Awake()
{
inventory = transform.GetComponent<Inventory>();
inventory.createEmptyInventory(8,10);
testItem = Instantiate(item1);
inventory.addItemAt(0, item1, 8);
inventory.addItemAt(0, item1, 1);
inventory.addItemAt(0, testItem, 1);
inventory.addItemAt(3, item2, 15);
inventory.addItemAt(4, item1, 3);
@@ -24,7 +29,9 @@ public class InventoryController : MonoBehaviour
Debug.Log(inventory.removeItemAt(0, 10));
Debug.Log(inventory.getInventory[0].Count);
*/
uiInventory.setInventory(inventory);
// uiInventory.setInventory(inventory);
}
void Start()
{
@@ -34,6 +41,14 @@ public class InventoryController : MonoBehaviour
// Update is called once per frame
void Update()
{
// FOR DEBUG
if (Input.GetKeyDown(KeyCode.X))
{
testItem.Select();
if(testItem.isSelected)
selectedItem = testItem;
else
selectedItem = null;
}
}
}