using UnityEngine; using WI; using TMPro; using System.Collections; using UnityEngine.UI; public class Panel_ToolBarAlarm : PanelBase { private TextMeshProUGUI Content; public float fadeTime; public Vector3 offset; public override void AfterAwake() { gameObject.SetActive(false); } public void ActiveAlarm(Vector3 pos, string value, bool isSuccess) { transform.position = new Vector3(pos.x + offset.x, pos.y + offset.y, 0); gameObject.SetActive(true); Content.SetText(value); StartCoroutine(ScaleDown()); } private IEnumerator ScaleDown() { float timer = 0f; float percent = 0f; while (percent < 1) { timer += Time.deltaTime; percent = timer / fadeTime; transform.localScale = Vector3.Lerp(transform.localScale, Vector3.one, percent); yield return null; } gameObject.SetActive(false); } }