void UpdateFrame(TimeSpan now) { var countToSignal = SignalTimes.TakeWhile(_ => _.key < now).Count(); for (var i = 0; i < countToSignal; i++) { var point = SignalTimes[0].item; SignalTimes.RemoveAt(0); UpdateSignal(point); } var countToThink = ThinkingTimes.TakeWhile(_ => _.key < now).Count(); for (var i = 0; i < countToThink; i++) { var point = ThinkingTimes[0].item; ThinkingTimes.RemoveAt(0); UpdateThinking(point); SignalTimes.AddForOrder(point); ThinkingTimes.AddForOrder(point); } }