static void Main(string[] args) { timeManager = new TimeManager(); coroutineManager = new CoroutineManager(timeManager); TestCoroutine(); }
static void TestAllOnce(List<TestCase> cases) { var timeManager = new TimeManager(); Test1(cases, timeManager); timeManager = new TimeManager(); Test1(cases, timeManager); var mgr = new TrivialTimeManager(); Test2(cases, mgr); mgr = new TrivialTimeManager(); Test2(cases, mgr); }
static void Test1(List<TestCase> cases, TimeManager mgr) { var maxTick = cases.Max(c => c.Tick); var results = new HashSet<uint>(); foreach (var c in cases) { TestCase c1 = c; mgr.AddTimer(c.Tick, (timer, data) => { if (mgr.FixedTicks == c1.Tick) results.Add((uint) data[0]); }, c.Id); } var begin = DateTime.Now; for (int i = 0; i < maxTick+1; i++) { mgr.FixedTick(); } var end = DateTime.Now; Console.WriteLine("TimeManagerCount:{0}, Time:{1}", results.Count, end - begin); }
public CoroutineManager(TimeManager timeManager) { this.timeManager = timeManager; }