private void OnTimeManagerTick(object sender, TickEventArgs tickEventArgs) { var count = 0; while (count++ < _schedule.Flights.Count && IsFlightHappend(tickEventArgs)) { FlightHappend(_schedule.Flights[_nextFlightIndex]); _nextFlightIndex = GetNextIndex(_nextFlightIndex); } _lastTime = tickEventArgs.Time; }
private bool IsFlightHappend(TickEventArgs tickEventArgs) { var time = _schedule.Flights[_nextFlightIndex].Time; return(time >= _lastTime && time <= tickEventArgs.Time || tickEventArgs.Time < _lastTime && (time >= _lastTime || time <= tickEventArgs.Time)); }
protected virtual void OnTick(TickEventArgs e) { Tick?.Invoke(this, e); }