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;
                }
            }
        }
示例#2
0
 public OrEvent(EventPromise a, EventPromise b) : base(Params.Empty)
 {
     this.a = a;
     this.b = b;
 }
        public void AddExternalCondition(EventPromise externalPromise, Func <Params, HandlerFuture> genNextHandler, bool stopOnTrigger)
        {
            Func <Params, IEnumerator <Params> > prevRoutine = routine;

            routine = (ps) => CheckingExternalCondition(ps, prevRoutine(ps), externalPromise, genNextHandler, stopOnTrigger);
        }