You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.0 KiB

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<TextMeshProUGUI>();
}
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;
}