49 lines
836 B
C#
49 lines
836 B
C#
using Obvious.Soap;
|
|
using UnityEngine;
|
|
|
|
public class UI_Inventory : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private BoolVariable isInventoryEnabled;
|
|
|
|
private CanvasGroup canvasGroup;
|
|
|
|
private void OnEnable()
|
|
{
|
|
canvasGroup = GetComponent<CanvasGroup>();
|
|
SetOff();
|
|
isInventoryEnabled.OnValueChanged += IsInventoryEnabled_OnValueChanged;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
isInventoryEnabled.OnValueChanged -= IsInventoryEnabled_OnValueChanged;
|
|
}
|
|
|
|
private void IsInventoryEnabled_OnValueChanged(bool value)
|
|
{
|
|
if (value)
|
|
{
|
|
SetOn();
|
|
}
|
|
else
|
|
{
|
|
SetOff();
|
|
}
|
|
}
|
|
|
|
private void SetOff()
|
|
{
|
|
canvasGroup.alpha = 0f;
|
|
canvasGroup.blocksRaycasts = false;
|
|
canvasGroup.interactable = false;
|
|
}
|
|
|
|
private void SetOn()
|
|
{
|
|
canvasGroup.alpha = 1f;
|
|
canvasGroup.blocksRaycasts = true;
|
|
canvasGroup.interactable = true;
|
|
}
|
|
}
|