void Update() { if (m_notificationQueue.Count > 0) { NotifInfo notif = m_notificationQueue.Peek(); // pass time for notification notif.timeLeft -= Time.deltaTime; // check if notif's time has run out if (notif.timeLeft <= 0) { m_notificationQueue.Dequeue(); // check if we have another queued if (m_notificationQueue.Count > 0) { NotifInfo nextNotif = m_notificationQueue.Peek(); // if we do, play it DisplayNotif(nextNotif); } else { // if we don't, close notif bar Close(); } } } }
private void DisplayNotif(NotifInfo notif) { Icon.sprite = notif.sprite; Text.text = notif.text; Button.onClick.RemoveAllListeners(); Button.onClick.AddListener(delegate { PhoneOS.OpenApp(notif.app); }); NotificationUI.SetActive(true); notifSound.Play(); }