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); } }
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); }
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(); }
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; } }
/// <summary> /// Triggering the source may trigger the destination. /// </summary> protected void Succession(ControlInput source, ControlOutput destination) { Relation(source, destination); }
/// <summary> /// Triggering the source may assign the destination value on the flow. /// </summary> protected void Assignment(ControlInput source, ValueOutput destination) { Relation(source, destination); }
/// <summary> /// Triggering the destination may fetch the source value. /// </summary> protected void Requirement(ValueInput source, ControlInput destination) { Relation(source, destination); }