using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { public class FairyTransmitPopUpExp : MonoBehaviour { [SerializeField] Animation m_Animation; [SerializeField] Text m_Exp; float overLifeTime = 0f; bool alive = false; public event Action onDie; public void DisplayExp(ulong exp) { alive = true; m_Exp.transform.localScale = Vector3.zero; m_Exp.text = StringUtility.Contact("+$", exp); m_Animation.Play(); overLifeTime = Time.time + 2.0f; } private void LateUpdate() { if (!alive) { return; } if (Time.time >= overLifeTime) { alive = false; if (onDie != null) { onDie(this); } } } } }