private void UpdateWarnings(RacingController controller) { if (controller.RoadController.OffTrack) { StartWarningIfNotRunning(controller); controller.WarningMessageDisplay.text = "Off Track<br>The Zombies will eat you!"; } else if (controller.RoadController.WrongDirection) { StartWarningIfNotRunning(controller); controller.WarningMessageDisplay.text = "Wrong direction<br>The Zombies will devour you!"; } else if (controller.CarController.CurrentSpeed < controller.MinSpeed) { // prevent stop } else if (controller.Hits > controller.WarningHits) { // prevent stop } else { controller.WarningMessageDisplay.text = ""; StopWarning(controller); } if (controller.Hits > controller.WarningHits) { StartWarningIfNotRunning(controller); } if (controller.CarController.CurrentSpeed < controller.MinSpeed) { controller.SpeedDisplayBlink.StartBlink(); StartWarningIfNotRunning(controller); } else { controller.SpeedDisplayBlink.StopBlink(); } if (WarningTime != null && WarningTime.IsRunning) { var a = controller.WarningZombie; var volume = controller.WarningIntensity.Evaluate(WarningTime.ElapsedMilliseconds / 1000.0f / controller.SecondsTillDeath); a.SetVolume(volume); if (volume >= 1.0f) // time elapsed = dead { ClearHUD(controller); a.Fadeout(); controller.CarController.Stop(); controller.SwitchToDead(); WarningTime.Stop(); } } }
public void Stop() { Elapsed = Timer.Elapsed; Timer.Stop(); }