using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TipWaitUnit : TipUnit { public Image m_spWait; public WaitData m_Data; public float m_waitTime = 0f; // 当前等待时间 public int m_speed = 20; // 旋转速度 public override void Awake() { base.Awake(); m_spWait = transform.Find("spWait/imgRobot").GetComponent(); } private void OnEnable() { Inform.Listen(eInformId.TipWaitClose, Close); } private void OnDisable() { Inform.Cancel(eInformId.TipWaitClose, Close); } public override void Refresh(TipData _Data) { base.Refresh(_Data); m_Data = (_Data as WaitData); } // Update is called once per frame void Update() { m_waitTime += Time.deltaTime; m_spWait.transform.Rotate(Vector3.forward, -m_speed * Time.deltaTime); if (m_waitTime > m_Data.m_waitTimeMax) { Tips.Instance.ShowDialog("等待超时"); Close(); } } void Close() { m_waitTime = 0f; gameObject.SetActive(false); } }