public static int Add(int delay, int cycle, Func <bool> handler) { Timer tm = new Timer(); tm.sn = ++nextSn; tm.cycle = cycle; tm.handler = handler; instance.mapSnTimer [tm.sn] = tm; instance.Add(now() + delay, tm); return(tm.sn); }
protected void delayFinish(AICtrl agent, State stat) { Action a = () => { this.state = stat; Action b = () => { if (this.parent != null) { this.parent.tryMoveNext(agent, stat); } }; TimerMng.Add(Delay, b); }; TimerMng.Add(Delay, a); }