using UnityEngine;
using TMPro;
using System.Collections;

public class TextPopup : UnitySingleton<TextPopup>
{
    public GameObject uiObj;
    public TMP_Text log; 
    public void Show(string text, float showTime)
    {
        log.text = text;
        uiObj.SetActive(true);
        StopAllCoroutines();
        StartCoroutine(ShowTextCoroutine(showTime));
    }
    IEnumerator ShowTextCoroutine(float time)
    {
        while (time >= 0)
        {
            time -= Time.deltaTime;
            yield return null;
        }
        uiObj.SetActive(false);
        yield return null;
    }
}
