private ControlOutput Trigger(Flow flow)
        {
            if (_eventType == null)
            {
                return(exit);
            }

            var eventInstance = System.Activator.CreateInstance(_eventType);

            for (var i = 0; i < inputPorts.Count; i++)
            {
                var inputPort = inputPorts[i];
                var key       = inputPort.key;
                var value     = flow.GetValue(inputPort);
                if (Info.reflectedFields.ContainsKey(key))
                {
                    var reflectedField = Info.reflectedFields[key];
                    reflectedField.SetValue(eventInstance, value);
                }
                else if (Info.reflectedProperties.ContainsKey(key))
                {
                    var reflectedProperty = Info.reflectedProperties[key];
                    reflectedProperty.SetValue(eventInstance, value);
                }
            }

            DefinedEventNode.Trigger(flow.GetValue <GameObject>(zzzEventTarget), eventInstance);

            return(exit);
        }
Beispiel #2
0
 /// <summary>
 /// Triggers Defined Event units listening for the passed eventData on the target gameobject.
 /// This is the scripting quivalent to the Trigger Defined Event unit.
 /// </summary>
 /// <param name="target">The game object that event units should listen on to receive the event.</param>
 /// <param name="eventData">This is a filled object of the type of event you want to trigger.</param>
 public static void Trigger(GameObject target, object eventData)
 {
     DefinedEventNode.Trigger(target, eventData);
 }