Esempio n. 1
0
 public void UpdateNotifications()
 {
     foreach (NotificationInfo notificationInfo in allNotifications)
     {
         GameObject notificationPredicate = Instantiate(notificationInfo.notificationPredicatePrefab, transform);
         bool       notificationSatisfied = notificationPredicate.GetComponent <INotificationPredicate>().EvaluatePredicate();
         if (notificationSatisfied)
         {
             Debug.Log("Notification Satisfied!");
             if (!addedNotifications.Contains(notificationInfo))
             {
                 OnNotificationAdded?.Invoke(notificationInfo);
                 addedNotifications.Add(notificationInfo);
             }
         }
         else
         {
             Debug.Log("Notification Not Satisfied!");
             if (allNotifications.Contains(notificationInfo))
             {
                 OnNotificationDeleted?.Invoke(notificationInfo);
                 addedNotifications.Remove(notificationInfo);
             }
         }
         Destroy(notificationPredicate);
     }
 }
Esempio n. 2
0
 public void Notify(Notification notification)
 {
     notifications.Enqueue(notification);
     OnNotificationAdded?.Invoke(notification);
 }