internal void Start(Event triggeringEvent, CommandChain chain, CommandRelay manager, ObjectPool pool) { this.triggeringEvent = triggeringEvent; this.manager = manager; this.pool = pool; failureAllocator = chain.FailureCommand; enumerator = chain.Commands.GetEnumerator(); pool.Lock(triggeringEvent, this); enumerator.MoveNext(); Next(); }
public CommandChain <T> On <T>() where T : class, Event, new() { EnsureKeyExists <T>(); var chain = new CommandChain <T>(); chains[typeof(T)].Add(chain); eventBus.AddListener <T>(ev => { var executor = pool.Allocate <EventCommandChainExecutor>(); activeExecutors.Add(executor); executor.Start(ev, chain, this, pool); }); return(chain); }