37 lines
792 B
C#
37 lines
792 B
C#
using UnityEngine;
|
|
using TMPro; // Required for TextMeshPro
|
|
|
|
public class InteractionUI : MonoBehaviour
|
|
{
|
|
public static InteractionUI Instance; // Singleton for easy access
|
|
public TextMeshProUGUI promptText;
|
|
|
|
void Awake()
|
|
{
|
|
if (Instance == null) Instance = this;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
// Hide text at start
|
|
if(promptText != null) promptText.text = "";
|
|
}
|
|
|
|
public void UpdatePrompt(string message)
|
|
{
|
|
if (promptText != null)
|
|
{
|
|
promptText.text = message;
|
|
promptText.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void ClearPrompt()
|
|
{
|
|
if (promptText != null)
|
|
{
|
|
promptText.text = "";
|
|
promptText.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |