Scriptum/Assets/Scripts/Inventory/InventoryManager.cs

39 lines
752 B
C#
Raw Normal View History

2022-05-15 18:54:59 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class InventoryManager : MonoBehaviour
{
public static int MAX_ITEMS = 5;
public static InventoryManager Instance;
public List<Item> items = new List<Item>();
private void Awake()
{
if(Instance == null)
{
Instance = this;
}else if (Instance != this)
{
Destroy(gameObject);
}
}
public void AddToInventory(Item pickable)
{
if(this.items.Count <= MAX_ITEMS)
{
this.items.Add(pickable);
}else {
// show popup - inventory is full
}
}
// public void DropItem()
// {
// }
}