Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite#55
34 lines
723 B
C#
34 lines
723 B
C#
|
|
using System;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
namespace UI
|
|
{
|
|
public class ItemUI:MonoBehaviour
|
|
{
|
|
public Entity.InventorySlot inventorySlot;
|
|
public UIImageAnimator icon;
|
|
|
|
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());
|
|
}
|
|
}
|
|
}
|
|
} |