public void TestSingleEvent(int timeSpan) { container.AddTimedEvent(TimeSpanType.Milliseconds, timeSpan, "msg", "par1", "par2"); // elapse timeSpan for events to expire var startTime = StaticTimer.GetElapsedMilliseconds(); var nowTime = 0.0; // save some space, because system timers are never 100% precise while ((nowTime = StaticTimer.GetElapsedMilliseconds()) - startTime < timeSpan + 10) { } container.ProcessTimedEvents(); bus.ProcessEventsSequentially(); // events must be processed on the main thread! Assert.AreEqual(1, processor.ObservedEvents); }
/// <summary> /// Updates level object logic /// </summary> public void Update() { Collision(); player.Update(); activeCustomersInlevel.Iterate(customer => { var platform = platformDictionary[customer.PlatformId].GetBoundingBox(); customer.Update(platform); }); UpdateCustomerPlatformText(); customerSpawnEvents.ProcessTimedEvents(); CustomerDespawnEvents.ProcessTimedEvents(); }