/// <summary>
        /// Stops the timers and disables control of all racers, also saves the historical records.
        /// </summary>
        public void StopRace()
        {
            m_IsRaceRunning = false;

            foreach (KeyValuePair <IRacer, Checkpoint> racerNextCheckpoint in m_RacerNextCheckpoints)
            {
                racerNextCheckpoint.Key.DisableControl();
                racerNextCheckpoint.Key.PauseTimer();
            }

            TrackRecord.Save(m_HistoricalBestLap);
            TrackRecord.Save(m_HistoricalBestRace);

            // displays game over menu and sets score
            gameOverCanvas.gameObject.SetActive(true);
            gameOverCanvas.SetScore(m_SessionBestLap.time, m_HistoricalBestLap.time);

            // adds coins to total number of coins
            CoinManager coinManager = FindObjectOfType <CoinManager>();

            if (coinManager == null)
            {
                Debug.LogError("Coin Manager missing in scene");
            }
            coinManager.SetCoinsNumber();
        }
예제 #2
0
        /// <summary>
        /// Stops the timers and disables control of all racers, also saves the historical records.
        /// </summary>
        public void StopRace()
        {
            m_IsRaceRunning = false;

            foreach (KeyValuePair <IRacer, Checkpoint> racerNextCheckpoint in m_RacerNextCheckpoints)
            {
                racerNextCheckpoint.Key.DisableControl();
                racerNextCheckpoint.Key.PauseTimer();
            }

            TrackRecord.Save(m_HistoricalBestLap);
            TrackRecord.Save(m_HistoricalBestRace);
        }
예제 #3
0
        /// <summary>
        /// Stops the timers and disables control of all racers, also saves the historical records.
        /// </summary>
        public void StopRace()
        {
            m_IsRaceRunning = false;

            foreach (KeyValuePair <IRacer, Checkpoint> racerNextCheckpoint in m_RacerNextCheckpoints)
            {
                racerNextCheckpoint.Key.DisableControl();
                racerNextCheckpoint.Key.PauseTimer();
            }

            TrackRecord.Save(m_HistoricalBestLap);
            TrackRecord.Save(m_HistoricalBestRace);

            //show main manu at end of race
            controller.ToggleMainMenu(true);
        }
예제 #4
0
        /// <summary>
        /// Stops the timers and disables control of all racers, also saves the historical records.
        /// </summary>
        public void StopRace()
        {
            m_IsRaceRunning = false;

            foreach (KeyValuePair <IRacer, Checkpoint> racerNextCheckpoint in m_RacerNextCheckpoints)
            {
                racerNextCheckpoint.Key.DisableControl();
                racerNextCheckpoint.Key.PauseTimer();
            }

            TrackRecord.Save(m_HistoricalBestLap);
            TrackRecord.Save(m_HistoricalBestRace);
            BestTime = SessionBestLap;                               //Obtengo el valor de mejor vuelta.
            BestTime = Mathf.Round(SessionBestLap * 100f) / 100f;    //Redondeo para tener solo 2 decimales.
            PlayerPrefs.SetString("Best time", BestTime.ToString()); //Convierto el número flotante a texto.
            PlayerPrefs.Save();                                      //Guardo el valor como texto.
        }