Scriptum/Assets/Scripts/Inventory/InventoryManager.cs

61 lines
1.2 KiB
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 : BaseWarehouseController
2022-05-15 18:54:59 +02:00
{
public static int MAX_ITEMS = 5;
public static InventoryManager Instance;
// temporary delegate dragged item to outside static object instance to remember it
[Space]
[SerializeField]
protected ISlot _draggedSlot;
public ISlot DraggedSlot
{
get { return _draggedSlot; }
set
{
_draggedSlot = value;
}
}
2022-05-15 18:54:59 +02:00
private void Awake()
{
if(Instance == null)
{
Instance = this;
}else if (Instance != this)
{
Destroy(gameObject);
}
}
2022-05-29 21:54:28 +02:00
public void AddToInventory(EquippableItem pickable)
2022-05-15 18:54:59 +02:00
{
if(this._items.Count <= MAX_ITEMS)
2022-05-15 18:54:59 +02:00
{
this._items[this._items.Count] = pickable;
2022-05-15 18:54:59 +02:00
}else {
Debug.Log("Cent add - Inventory is full");
2022-05-15 18:54:59 +02:00
}
}
protected override void SetupPanel()
{
if(this.dynamicPanel)
{
this.dynamicPanel.GetComponent<InventoryPanelController>().Setup(gameObject, _items);
}
}
2022-05-15 18:54:59 +02:00
// public void DropItem()
// {
// }
2022-05-15 18:54:59 +02:00
}