Esempio n. 1
0
        private EventSystemPublisher <T> GetEventPublisher <T>(Type type) where T : IKnetikEvent
        {
            EventPublisherBase subscriber = GetEventPublisherBase(type);

            if (subscriber != null)
            {
                EventSystemPublisher <T> eventPublisher = subscriber as EventSystemPublisher <T>;
                UnityEngine.Debug.Assert(eventPublisher != null, "Event publisher cannot be null!");
                return(eventPublisher);
            }

            return(null);
        }
Esempio n. 2
0
        public void Publish(IKnetikEvent e)
        {
            UnityEngine.Debug.Assert(e != null, "Event System - parameter 'e' cannot be null!");

            EventPublisherBase subscriber = GetEventPublisherBase(e.GetType());

            if (subscriber != null)
            {
                try
                {
                    subscriber.PostEvent(e);
                }
                catch (Exception ex)
                {
                    KnetikLogger.LogError(string.Format("There was an error processing an event! Event: {0} : {1}, Reason: {2}.", e.GetType(), e, ex));
                }
            }
        }