Example #1
0
 /// <summary>
 /// Sending the awake notification. - null awaker means its a reciever waking up.
 /// </summary>
 private void Start()
 {
     EventObjectAwake.Data data = new EventObjectAwake.Data();
     data.Name   = associatedName;
     data.awaker = null;
     EventManager.TriggerEvent(new EventObjectAwake(data));
 }
Example #2
0
        /// <summary>
        /// Handling either the EventObjectAwake events.
        /// </summary>
        /// <param name="evt">The event that is being sent here.</param>
        /// <returns>Whether or not to cascade the event.</returns>
        public ListenerResult HandleEvent(IEvent evt)
        {
            string evtName = evt.GetName();

            switch (evtName)
            {
            case EventObjectAwake.EventName:

                //invoking the unity events if its the correct target - null awaker means its the reciever waking up.
                EventObjectAwake.Data data = (EventObjectAwake.Data)evt.GetData();
                if (data.awaker != null && data.Name.Equals(associatedName))
                {
                    eventsToCall.Invoke(data.awaker);
                }

                return(ListenerResult.Handled);
            }

            return(ListenerResult.Ignored);
        }
Example #3
0
        /// <summary>
        /// Handling either the EventObjectAwake events.
        /// </summary>
        /// <param name="evt">The event that is being sent here.</param>
        /// <returns>Whether or not to cascade the event.</returns>
        public ListenerResult HandleEvent(IEvent evt)
        {
            string evtName = evt.GetName();

            switch (evtName)
            {
            case EventObjectAwake.EventName:

                //null awaker means its a reciever requesting events.
                //if a reciever of this event wakes up and we are ready to recieve the event (we woke up first) then we should tell the reciever that we are already awake.
                EventObjectAwake.Data data = (EventObjectAwake.Data)evt.GetData();
                if (data.awaker == null && data.Name.Equals(associatedName))
                {
                    Start();
                }

                return(ListenerResult.Handled);
            }

            return(ListenerResult.Ignored);
        }