public override void Start(RacingController controller) { controller.InfoDisplay.text = ""; TimeCountdownStarted = Time.time; CurrentCountdown = CountdownFrom; controller.CarUserControl.enabled = false; }
public override void Update(RacingController controller) { UpdateTimerPauseState(controller); UpdateTime(controller); UpdateWarnings(controller); UpdateSpeed(controller); }
public override void Start(RacingController controller) { controller.StateRacing.ClearHUD(controller); controller.DeathScreen.ShowAll(); controller.CarUserControl.enabled = false; controller.ZombieEatingAudio.Play(); }
private void UpdateTimerPauseState(RacingController controller) { if (controller.PauseMenuManager.GamePaused) { if (WarningTime != null && !WarningTime.IsPaused) { WarningTime.Pause(); } if (CurrentRound != null && !CurrentRound.Timer.IsPaused) { CurrentRound.Timer.Pause(); } } else { if (WarningTime != null && WarningTime.IsPaused) { WarningTime.Unpause(); } if (CurrentRound != null && CurrentRound.Timer.IsPaused) { CurrentRound.Timer.Unpause(); } } }
public void ClearHUD(RacingController controller) { controller.InfoDisplay.text = ""; controller.TimeDisplay.text = ""; controller.WarningMessageDisplay.text = ""; controller.SpeedDisplay.text = ""; controller.NormalInfoDisplay.text = ""; }
public override void Start(RacingController controller) { Rounds = new List <RoundInformation>(); CurrentRound = new RoundInformation(); controller.CarUserControl.enabled = true; ClearHUD(controller); }
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(); } } }
private void StopWarning(RacingController controller) { if (WarningTime == null) { return; } WarningTime.Stop(); var a = controller.WarningZombie; a.Fadeout(); }
public override void Update(RacingController controller) { CurrentCountdown = CountdownFrom - Mathf.FloorToInt(Time.time - TimeCountdownStarted); controller.InfoDisplay.text = "" + CurrentCountdown + ""; if (CurrentCountdown <= 0) { controller.InfoDisplay.text = ""; controller.SwitchToRacing(); } }
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()); } }
private void UpdateTime(RacingController controller) { controller.LapDisplay.text = (Rounds.Count + 1) + " / " + controller.LapsToWin; var currentTime = FloatToRaceTime(CurrentRound.Duration()); var lastTimes = ""; for (var i = Rounds.Count - 1; i >= Math.Max(Rounds.Count - 3, 0); i--) { var r = Rounds[i]; lastTimes += FloatToRaceTime(r.Duration()) + "\n"; } var timeDisplay = currentTime + "\n<size=50%>"; timeDisplay += lastTimes; timeDisplay += "</size>"; controller.TimeDisplay.text = timeDisplay; }
private void StartWarningIfNotRunning(RacingController controller) { var wasRunning = true; if (WarningTime == null) { WarningTime = new PausableStopwatch(); wasRunning = false; } else if (!WarningTime.IsRunning) { WarningTime.Start(); wasRunning = false; } if (!wasRunning) { // play sound var a = controller.WarningZombie; a.Play(controller.WarningIntensity.Evaluate(0)); } }
public abstract void Update(RacingController controller);
public override void Start(RacingController controller) { controller.StateRacing.ClearHUD(controller); controller.SuccessScreen.ShowAll(); controller.CarUserControl.enabled = false; }
public virtual void ClearHUD(RacingController controller) { }
public virtual void OnStartFinishTrigger(RacingController controller) { }
public override void ClearHUD(RacingController controller) { controller.DeathScreen.HideAll(); controller.SuccessScreen.HideAll(); }
private void UpdateSpeed(RacingController controller) { controller.SpeedDisplay.text = controller.CarController.CurrentSpeed.ToString("000") + " km/h"; }
public override void Update(RacingController controller) { }
public abstract void Start(RacingController controller);