Beispiel #1
0
        private IEnumerable InvokeCoroutineDelegate(ControlInput input)
        {
            var instructions = input.coroutineAction(this);

            while (true)
            {
                object instruction;

                try
                {
                    if (!instructions.MoveNext())
                    {
                        break;
                    }

                    instruction = instructions.Current;
                }
                catch (Exception ex)
                {
                    input.unit.HandleException(stack, ex);
                    throw;
                }

                yield return(instruction);
            }
        }
Beispiel #2
0
        protected ControlInput ControlInputCoroutine(string key, Func <Flow, ControlOutput> action, Func <Flow, IEnumerator> coroutineAction)
        {
            EnsureUniqueInput(key);
            var port = new ControlInput(key, action, coroutineAction);

            controlInputs.Add(port);
            return(port);
        }
Beispiel #3
0
        protected ControlInput ControlInput(string key, Func <Flow, ControlOutput> action)
        {
            EnsureUniqueInput(key);
            var port = new ControlInput(key, action);

            controlInputs.Add(port);
            return(port);
        }
        protected void Connect(ControlOutput source, ControlInput destination)
        {
            Undo.IncrementCurrentGroup();
            LudiqEditorUtility.editedObject.BeginOverride(m_Reference.serializedObject);
            var widget            = new ControlOutputWidget(m_Canvas, source);
            var connectMethodInfo = GetConnectionMethodInfo(widget.GetType());

            connectMethodInfo?.Invoke(widget, new object[] { widget.port, destination });
            LudiqEditorUtility.editedObject.EndOverride();
        }
Beispiel #5
0
        private ControlOutput InvokeDelegate(ControlInput input)
        {
            try
            {
                if (input.requiresCoroutine)
                {
                    throw new InvalidOperationException($"Port '{input.key}' on '{input.unit}' can only be triggered in a coroutine.");
                }

                return(input.action(this));
            }
            catch (Exception ex)
            {
                input.unit.HandleException(stack, ex);
                throw;
            }
        }
Beispiel #6
0
 /// <summary>
 /// Triggering the source may trigger the destination.
 /// </summary>
 protected void Succession(ControlInput source, ControlOutput destination)
 {
     Relation(source, destination);
 }
Beispiel #7
0
 /// <summary>
 /// Triggering the source may assign the destination value on the flow.
 /// </summary>
 protected void Assignment(ControlInput source, ValueOutput destination)
 {
     Relation(source, destination);
 }
Beispiel #8
0
 /// <summary>
 /// Triggering the destination may fetch the source value.
 /// </summary>
 protected void Requirement(ValueInput source, ControlInput destination)
 {
     Relation(source, destination);
 }