Files
BABA_YAGA/Assets/Scripts/Player/Generic/Triggers/vTutorialTextTrigger.cs
2026-06-04 10:42:23 +07:00

42 lines
1.0 KiB
C#

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 = " ";
}
}
}