public void PushNotification(string Msg) { Notifications.Add(Msg); DisplayNotificationBox.SetActive(true); NotificationTime = 0; isNotifOpen = true; }
// Update is called once per frame void Update() { NameOneText.GetComponent <TextMeshProUGUI>().text = GameStatusScript.getInstance().PlayerNameOne; NameTwoText.GetComponent <TextMeshProUGUI>().text = GameStatusScript.getInstance().PlayerNameTwo; ScoreOneText.GetComponent <TMPro.TextMeshProUGUI>().text = GameStatusScript.getInstance().Score_Player_1.ToString(); ScoreTwoText.GetComponent <TMPro.TextMeshProUGUI>().text = GameStatusScript.getInstance().Score_Player_2.ToString(); if (isNotifOpen) { if (!keepNotifOpen) { if (NotificationTime >= NotificationTimeLimit) { NotificationTime = 0; if (Notifications.Count != 0) { string notif = Notifications.First(); Notifications.RemoveAt(0); DisplayNotificationBox.transform.GetChild(0).transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = notif; DisplayNotificationBox.SetActive(true); } else { DisplayNotificationBox.SetActive(false); isNotifOpen = false; keepNotifOpen = false; } } else { NotificationTime += Time.deltaTime; } } } }