hellbound/Assets/Scripts/Game/UI/ChestView.cs

39 lines
1.0 KiB
C#

using UnityEngine;
using UnityEngine.UI;
public class ChestView : MonoBehaviour
{
[Header("Fields")]
[SerializeField] private Image _icon = null;
[SerializeField] private GameObject _openVFX = null;
[SerializeField] private Text _message = null;
[Header("View")]
[SerializeField] private Sprite _closedIcon = null;
[SerializeField] private Sprite _openedIcon = null;
// [SerializeField] private Animator _animator = null;
public void SetCloseView()
{
_icon.sprite = _closedIcon;
_message.transform.parent.gameObject.SetActive(false);
_openVFX.SetActive(false);
// _animator.enabled = true;
}
public void SetOpenView(string value)
{
_icon.sprite = _openedIcon;
_message.text = value;
_message.transform.parent.gameObject.SetActive(true);
_openVFX.SetActive(true);
// _animator.enabled = false;
}
public bool IsOpen()
{
return _icon.sprite == _openedIcon;
}
}