private IEnumerator HideAnnouncerText(float secondsToHide, Action actionAfterAnnouncer) { yield return(new WaitForSeconds(secondsToHide)); AnnouncerTextGameObject.SetActive(false); actionAfterAnnouncer?.Invoke(); }
private void Start() { BatteryTextGameObjects = new GameObject[0]; LivesTextGameObjects = new GameObject[0]; LightningCoroutines = new List <Coroutine>(); FloorDarkColor = FloorTilemap.color; AnnouncerTextGameObject.SetActive(false); LightningTicker = UnityEngine.Random.Range(LightningTickerMin, LightningTickerMax); }
public void ShowAnnouncerText(string text, Color color, bool permanent, float secondsToHide = 0, Action actionAfterAnnouncer = null) { AnnouncerTextGameObject.GetComponent <TextMeshProUGUI>().text = text; AnnouncerTextGameObject.GetComponent <TextMeshProUGUI>().color = color; AnnouncerTextGameObject.SetActive(true); if (!permanent) { StartCoroutine(HideAnnouncerText(secondsToHide, actionAfterAnnouncer)); } }