using UnityEngine; using System.Collections; using System.Collections.Generic; public class Notification{ public GameObject source; public string text; } public enum NotificationElement{ Text, Item, ImportantText } public class NotificationsController : MonoBehaviour { public HudController hud; private static string itemColor = "00ff00ff"; private static List _notifications = new List(); public static void AddNotification(Notification n){ _notifications.Add(n); } public static string AppendString(string src, string txt, NotificationElement elementType){ var result = src; if(elementType == NotificationElement.Item){ result += "" + txt + ""; }else if(elementType == NotificationElement.ImportantText){ result += "" + txt + ""; }else{ result += txt; } return result; } public static void RemoveNotification(Notification n){ _notifications.Remove(n); } // Use this for initialization void Start () { } void OnGUI(){ } // Update is called once per frame void Update () { if(_notifications != null && _notifications.Count > 0){ hud.SetNotify(_notifications[0].text); }else{ hud.SetNotify(""); } } }