Exemple #1
0
 public override void Start(RacingController controller)
 {
     controller.InfoDisplay.text       = "";
     TimeCountdownStarted              = Time.time;
     CurrentCountdown                  = CountdownFrom;
     controller.CarUserControl.enabled = false;
 }
Exemple #2
0
 public override void Update(RacingController controller)
 {
     UpdateTimerPauseState(controller);
     UpdateTime(controller);
     UpdateWarnings(controller);
     UpdateSpeed(controller);
 }
Exemple #3
0
 public override void Start(RacingController controller)
 {
     controller.StateRacing.ClearHUD(controller);
     controller.DeathScreen.ShowAll();
     controller.CarUserControl.enabled = false;
     controller.ZombieEatingAudio.Play();
 }
Exemple #4
0
        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();
                }
            }
        }
Exemple #5
0
 public void ClearHUD(RacingController controller)
 {
     controller.InfoDisplay.text           = "";
     controller.TimeDisplay.text           = "";
     controller.WarningMessageDisplay.text = "";
     controller.SpeedDisplay.text          = "";
     controller.NormalInfoDisplay.text     = "";
 }
Exemple #6
0
        public override void Start(RacingController controller)
        {
            Rounds       = new List <RoundInformation>();
            CurrentRound = new RoundInformation();
            controller.CarUserControl.enabled = true;

            ClearHUD(controller);
        }
Exemple #7
0
        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();
                }
            }
        }
Exemple #8
0
        private void StopWarning(RacingController controller)
        {
            if (WarningTime == null)
            {
                return;
            }

            WarningTime.Stop();
            var a = controller.WarningZombie;

            a.Fadeout();
        }
Exemple #9
0
        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();
            }
        }
Exemple #10
0
        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());
            }
        }
Exemple #11
0
        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;
        }
Exemple #12
0
        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));
            }
        }
Exemple #13
0
 public abstract void Update(RacingController controller);
Exemple #14
0
 public override void Start(RacingController controller)
 {
     controller.StateRacing.ClearHUD(controller);
     controller.SuccessScreen.ShowAll();
     controller.CarUserControl.enabled = false;
 }
Exemple #15
0
 public virtual void ClearHUD(RacingController controller)
 {
 }
Exemple #16
0
 public virtual void OnStartFinishTrigger(RacingController controller)
 {
 }
Exemple #17
0
 public override void ClearHUD(RacingController controller)
 {
     controller.DeathScreen.HideAll();
     controller.SuccessScreen.HideAll();
 }
Exemple #18
0
 private void UpdateSpeed(RacingController controller)
 {
     controller.SpeedDisplay.text = controller.CarController.CurrentSpeed.ToString("000") + " km/h";
 }
Exemple #19
0
 public override void Update(RacingController controller)
 {
 }
Exemple #20
0
 public abstract void Start(RacingController controller);