public override void Start(RacingController controller) { Rounds = new List <RoundInformation>(); CurrentRound = new RoundInformation(); controller.CarUserControl.enabled = true; ClearHUD(controller); }
public override void OnStartFinishTrigger(RacingController controller) { CurrentRound.Stop(); Rounds.Add(CurrentRound); var roundTime = -1; if (CurrentRound != null) { roundTime = CurrentRound.Duration().Milliseconds; } CurrentRound = new RoundInformation(); if (Rounds.Count >= controller.LapsToWin) { controller.WarningZombie.Stop(); controller.CarController.Stop(); controller.SwitchToWon(); } else { if (Rounds.Count == controller.LapsToWin - 1) { controller.NormalInfoDisplay.text = "Final Round"; controller.FinalRoundAudio.Play(); } else { controller.NormalInfoDisplay.text = "Next Lap"; // is this a new best time? if (roundTime > 0) { for (var i = 0; i < Rounds.Count; i++) { if (Rounds[i].Duration().Milliseconds < roundTime) { controller.NewBestTime.Play(); break; } } } } controller.StartCoroutine(controller.ClearInfoDisplay()); } }