Exemplo n.º 1
0
        public static bool PostNotification <T>(UnityEngine.GameObject sender, T notification, bool bNotifyEntity = false) where T : Notification
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (notification == null)
            {
                throw new ArgumentNullException("notification");
            }

            if (bNotifyEntity)
            {
                var dispatcher = sender.AddOrGetComponent <GameObjectNotificationDispatcher>();
                return(dispatcher.Observers.PostNotification <T>(notification, bNotifyEntity));
            }
            else
            {
                var dispatcher = sender.GetComponent <GameObjectNotificationDispatcher>();
                return(dispatcher != null && dispatcher.Observers.PostNotification <T>(notification, bNotifyEntity));
            }
        }