Files
BABA_YAGA/Assets/Scripts/Player/Generic/Triggers/vTutorialTextTrigger.cs

42 lines
1.0 KiB
C#
Raw Normal View History

2026-05-30 09:16:35 +07:00
using UnityEngine;
using UnityEngine.UI;
namespace Invector
{
public class vTutorialTextTrigger : MonoBehaviour
{
[TextAreaAttribute(5, 3000), Multiline]
public string text;
public Text _textUI;
public GameObject painel;
protected virtual void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
EnableTutorialPanel();
}
}
public virtual void EnableTutorialPanel()
{
painel.SetActive(true);
_textUI.gameObject.SetActive(true);
_textUI.text = text;
}
protected virtual void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
DisableTutorialPanel();
}
}
public virtual void DisableTutorialPanel()
{
painel.SetActive(false);
_textUI.gameObject.SetActive(false);
_textUI.text = " ";
}
}
}