39 lines
752 B
C#
39 lines
752 B
C#
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()
|
|
// {
|
|
|
|
// }
|
|
}
|