private void OnTick(object sender, EventArgs e) { if (CurrentRace?.IsRacing == true) { CurrentRace.Tick(); } else if (CurrentRace?.IsRacing == false) { CurrentRace.Dispose(); LoadStartBlips(); CurrentRace = null; } else { if (CanStart()) { foreach (var raceStartPoint in configuration.RaceStartPoints) { if (Game.Player.Character.Position.DistanceTo(raceStartPoint.Position) < 20f) { UI.ShowSubtitle("Start race"); } } } } // Record Track RecordTrack(); }
protected override void Dispose(bool A_0) { UI.Notify("StreetRacing aborted"); CurrentRace?.Dispose(); ClearStartBlips(); foreach (var blip in RecordedCheckpoints.Select(x => x.Blip)) { blip.Remove(); } }