Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        protected override void Definition()
        {
            enter = ControlInput("enter", ProcessInternal);
            exit  = ControlOutput("exit");

            Succession(enter, exit);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        protected ControlInput ControlInput(string key, Func <Flow, ControlOutput> action)
        {
            EnsureUniqueInput(key);
            var port = new ControlInput(key, action);

            controlInputs.Add(port);
            return(port);
        }
Exemplo n.º 5
0
        protected override void Definition()
        {
            enterTrue  = ControlInput("true", ProcessTrue);
            enterFalse = ControlInput("false", ProcessFalse);
            exit       = ControlOutput("exit");

            valueOut = ValueOutput("value", (flow) => m_value);

            Succession(enterTrue, exit);
            Succession(enterFalse, exit);
        }
Exemplo n.º 6
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;
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Triggering the source may trigger the destination.
 /// </summary>
 protected void Succession(ControlInput source, ControlOutput destination)
 {
     Relation(source, destination);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Triggering the source may assign the destination value on the flow.
 /// </summary>
 protected void Assignment(ControlInput source, ValueOutput destination)
 {
     Relation(source, destination);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Triggering the destination may fetch the source value.
 /// </summary>
 protected void Requirement(ValueInput source, ControlInput destination)
 {
     Relation(source, destination);
 }
Exemplo n.º 10
0
 protected override void Definition()
 {
     trigger = ControlInput(nameof(trigger), Trigger);
 }
Exemplo n.º 11
0
 protected override void Definition()
 {
     enter = ControlInput(nameof(enter), Operation);
 }