Files
Gen_Hack-and-Slash-Roguelite/Client/Assets/Scripts/UI/ItemUI.cs

34 lines
723 B
C#
Raw Normal View History

2025-08-28 16:20:24 +08:00
using System;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
namespace UI
{
public class ItemUI:MonoBehaviour
{
public Entity.InventorySlot inventorySlot;
public UIImageAnimator icon;
2025-08-28 16:20:24 +08:00
private void Start()
{
icon.gameObject.SetActive(false);
}
public void SetDisplayItem(Entity.InventorySlot slot)
{
inventorySlot = slot;
if (inventorySlot == null)
{
icon.gameObject.SetActive(false);
}
else
{
icon.gameObject.SetActive(true);
icon.SetSprites(inventorySlot.Item.Icon.ToArray());
}
}
}
}