public ReturnEventArg(ReturnEventData data)
 {
     trigger    = data.args.trigger;
     callback   = data.args.callback;
     isCallback = data.args.isCallback;
     target     = data.args.target;
     global     = data.args.global;
     arguments  = data.args.arguments;
     name       = data.args.name;
 }
 public ReturnEventArg(Action <object> callback, UnityEngine.GameObject target, string name, bool global, object[] arguments = null)
 {
     this.trigger   = null;
     this.callback  = callback;
     isCallback     = true;
     this.target    = target;
     this.global    = global;
     this.arguments = arguments;
     this.name      = name;
 }
 public ReturnEventArg(TriggerReturnEvent trigger, UnityEngine.GameObject target, string name, bool global, object[] arguments = null)
 {
     this.trigger   = trigger;
     callback       = null;
     isCallback     = false;
     this.target    = target;
     this.global    = global;
     this.arguments = arguments;
     this.name      = name;
 }
예제 #4
0
        /// <summary>
        /// Set the data to return back, then triggers a return back to the ReturnEventUnit.
        /// </summary>
        public ControlOutput Enter(Flow flow)
        {
            var _data = flow.GetValue <ReturnEventData>(data);
            var val   = flow.GetValue(value);

            if (_data.args.trigger != null)
            {
                _data.args.trigger.storingValue = val;
            }
            if (_data.args.isCallback)
            {
                _data.args.callback?.DynamicInvoke(val);
            }
            else
            {
                TriggerReturnEvent.Trigger(_data.args);
            }
            return(null);
        }
예제 #5
0
 /// <summary>
 /// Trigger the return event. This is meant for internal use of the trigger unit.
 /// </summary>
 /// <param name="trigger">The trigger unit we will return to when it hits a return unit.</param>
 /// <param name="target">The gameobject target of the event</param>
 /// <param name="name">The name of the event.</param>
 /// <param name="global">Is the event global to all Return Events? Will ignore the target GameObject. Target can be null in this case.</param>
 /// <param name="args">The arguments to send through.</param>
 public static void Trigger(TriggerReturnEvent trigger, GameObject target, string name, bool global = false, params object[] args)
 {
     EventBus.Trigger <ReturnEventArg>("Return", new ReturnEventArg(trigger, target, name, global, args));
 }