/// <summary>
 /// set up only one event
 /// </summary>
 protected virtual void SetupEvents()
 {
     if (Events.Count > 0)
     {
         InteractableEvent.EventLists lists = InteractableEvent.GetEventTypes();
         Events[0].Receiver      = InteractableEvent.GetReceiver(Events[0], lists);
         Events[0].Receiver.Host = this;
     }
 }
        /// <summary>
        /// starts the event system
        /// </summary>
        protected virtual void SetupEvents()
        {
            InteractableEvent.EventLists lists = InteractableEvent.GetEventTypes();

            for (int i = 0; i < Events.Count; i++)
            {
                Events[i].Receiver      = InteractableEvent.GetReceiver(Events[i], lists);
                Events[i].Receiver.Host = this;
            }
        }
예제 #3
0
        /// <summary>
        /// Create the event and setup the values from the inspector
        /// </summary>
        /// <param name="iEvent"></param>
        /// <param name="lists"></param>
        /// <returns></returns>
        public static ReceiverBase GetReceiver(InteractableEvent iEvent, EventLists lists)
        {
            int  index     = InspectorField.ReverseLookup(iEvent.ClassName, lists.EventNames.ToArray());
            Type eventType = lists.EventTypes[index];
            // apply the settings?
            ReceiverBase newEvent = (ReceiverBase)Activator.CreateInstance(eventType, iEvent.Event);

            InspectorGenericFields <ReceiverBase> .LoadSettings(newEvent, iEvent.Settings);

            return(newEvent);
        }
 protected virtual void SetupEventOptions()
 {
     InteractableEvent.EventLists lists = InteractableEvent.GetEventTypes();
     eventTypes   = lists.EventTypes.ToArray();
     eventOptions = lists.EventNames.ToArray();
 }