projectEli/Assets/Inventory System/Scripts/UI/LimitStackSlot.cs
2023-03-13 05:05:53 -07:00

57 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
namespace SimpleInventorySystem
{
public class LimitStackSlot : MonoBehaviour
{
[HideInInspector] public SlotUI Slot;
//public int Weight;
//[HideInInspector] public LimitStackSlotManager limitStackSlotCapacities;
[HideInInspector] public LimitStackItemManager limitStackItemManager;
[HideInInspector] public int Count;
public TextMeshProUGUI CountText;
public void SetCount()
{
Count = Slot.stackedItems.Count;
CountText.text = Count.ToString();
}
public void Increment(ItemUI itemUI)
{
limitStackItemManager.Increment(itemUI);
SetCount();
}
public void Decrement(ItemUI itemUI)
{
limitStackItemManager.Decrement(itemUI);
SetCount();
}
public bool HasReachedLimit(ItemUI itemUI)
{
return limitStackItemManager.itemUI.WillExceedMaximumCapacity(itemUI.NestCapacityWeight);
}
private void Awake()
{
Slot = GetComponent<SlotUI>();
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}