using TMPro; using UnityEngine; public class TalkBox : IVTraceTarget { private TextMeshProUGUI txtTalk; public override void SetCameraTarget(Camera cammain, Camera camui, RectTransform trfpr, Transform trftarget, float foffsety) { base.SetCameraTarget(cammain, camui, trfpr, trftarget, foffsety); txtTalk = trfSelf.GetChild(0).GetChild(0).GetComponent(); } public void ShowTalkBox(string strtext, float ftime) { CancelInvoke(nameof(HideObject)); txtTalk.text = strtext; SetPosition(); gameObject.SetActive(true); Invoke(nameof(HideObject), ftime); } public void ShowTalkBox(Transform trftarget, float foffsety, string strtext, float ftime) { trfTarget = trftarget; fOffsetY = foffsety; ShowTalkBox(strtext, ftime); } public void HideObject() { CancelInvoke(nameof(HideObject)); gameObject.SetActive(false); } public bool IsShow() => gameObject.activeSelf; }