private IEnumerator <Params> CheckingExternalCondition(Params ps, IEnumerator <Params> prevRoutine, EventPromise externalPromise, Func <Params, HandlerFuture> genNextHandler, bool stopOnTrigger)
        {
            EventPromise clonedPromise = externalPromise.Clone();

            clonedPromise.Reset();
            while (true)
            {
                prevRoutine.MoveNext();
                if (clonedPromise.IsTriggered())
                {
                    clonedPromise.Reset();
                    genNextHandler(ps).Begin();
                    if (stopOnTrigger)
                    {
                        yield break;
                    }
                }
                clonedPromise.Update();
                yield return(prevRoutine.Current);

                if (prevRoutine.Current == null)
                {
                    yield break;
                }
            }
        }
Beispiel #2
0
        public override Dictionary <string, Action> GetUpdates()
        {
            Dictionary <string, Action> result = new Dictionary <string, Action>();
            var allUpdates = a.GetUpdates().Concat(b.GetUpdates()).ToDictionary(x => x.Key, y => y.Value);

            result.Add("OR:" + allUpdates.Aggregate("", (acc, p) => acc + p.Key), () =>
            {
                foreach (var up in allUpdates)
                {
                    up.Value();
                }
                if (a.IsTriggered() || b.IsTriggered())
                {
                    Trigger(Params.Empty);
                }
            }
                       );
            return(result);
        }