void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); } if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestLap.SetRecord(trackName, raceLapTotal, racer, raceTime); } racer.DisableControl(); racer.PauseTimer(); } } if (CanEndRace()) { StopRace(); GameObject kart = GameObject.Find("Kart"); kart.GetComponent <KartPoints>().SaveCoins(); } else { for (int i = 0; i < 6; i++) { CoinManager.transform.GetChild(i).gameObject.SetActive(true); } } racer.HitStartFinishLine(); } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); } if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestLap.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (firstCarToFinish) { victoryEvent.Invoke(); firstCarToFinish = false; } NumFinished++; racer.DisableControl(); racer.PauseTimer(); } } if (CanEndRace()) { StopRace(); } racer.HitStartFinishLine(); } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); } if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestLap.SetRecord(trackName, raceLapTotal, racer, raceTime); } racer.DisableControl(); racer.PauseTimer(); } else { collectableManager.RemoveCollectables(); collectableManager.PlaceCollectables(); } } if (CanEndRace()) { StopRace(); } racer.HitStartFinishLine(); hitFirstCheckpoint = false; } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); } RecordCanvas.SetActive(true); if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestLap.SetRecord(trackName, raceLapTotal, racer, raceTime); } racer.DisableControl(); racer.PauseTimer(); } } if (CanEndRace()) { StopRace(); } if (racerCurrentLap >= 3) { GameOverPanel.SetActive(true); } //Muestro el panel de Game Over al terminar la carrera racer.HitStartFinishLine(); } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); newRecordCanvas.TempDisplay(); } if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } racer.DisableControl(); racer.PauseTimer(); SaveManager.saveManager.Load(); // Not necessary since it was loaded on the main menu, done here as a double check SaveManager.saveManager.earnedCoins += earnedCoins; SaveManager.saveManager.Save(); gameOverCanvas.gameObject.SetActive(true); } for (int i = 0; i < coins.Length; i++) // desactivating & activating rather than deleting and respawning coins { coins[i].gameObject.SetActive(true); } } if (CanEndRace()) { StopRace(); } racer.HitStartFinishLine(); } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); newRecordCanvas.gameObject.SetActive(true); } if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } racer.DisableControl(); racer.PauseTimer(); } } if (CanEndRace()) { StopRace(); } racer.HitStartFinishLine(); } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); } /* * if (racerCurrentLap == raceLapTotal) * { * float raceTime = racer.GetRaceTime (); * * if (m_SessionBestRace.time > raceTime) * m_SessionBestRace.SetRecord (trackName, raceLapTotal, racer, raceTime); * * if (m_HistoricalBestRace.time > raceTime) * m_HistoricalBestLap.SetRecord (trackName, raceLapTotal, racer, raceTime); * * //racer.DisableControl (); * //racer.PauseTimer (); * }*/ } /* * if (CanEndRace ()) * StopRace (); */ racer.HitStartFinishLine(); } }
void RacerHitCorrectCheckpoint(IRacer racer, Checkpoint checkpoint) { if (checkpoint.isStartFinishLine) { int racerCurrentLap = racer.GetCurrentLap(); currentLapAnswer = racerCurrentLap; if (racerCurrentLap > 0) { float lapTime = racer.GetLapTime(); if (m_SessionBestLap.time > lapTime) { m_SessionBestLap.SetRecord(trackName, 1, racer, lapTime); } if (m_HistoricalBestLap.time > lapTime) { m_HistoricalBestLap.SetRecord(trackName, 1, racer, lapTime); } if (racerCurrentLap == raceLapTotal) { float raceTime = racer.GetRaceTime(); if (m_SessionBestRace.time > raceTime) { m_SessionBestRace.SetRecord(trackName, raceLapTotal, racer, raceTime); } if (m_HistoricalBestRace.time > raceTime) { m_HistoricalBestLap.SetRecord(trackName, raceLapTotal, racer, raceTime); } racer.DisableControl(); racer.PauseTimer(); } if (racerCurrentLap < raceLapTotal) { switch (tema) { //case 1: // loadOptionsQuestions(racerCurrentLap, questions_mru, answersOptions_mru); // break; case 2: loadOptionsQuestions(racerCurrentLap, questions_mruv, answersOptions_mruv); break; default: Debug.Log("Tema incorrecto!"); break; } } } if (CanEndRace()) { StopRace(); panelEndGame.gameObject.SetActive(true); } racer.HitStartFinishLine(); } Debug.Log("Entro ckeckpoint !"); if (checkpoint.isFinishLine) { StopRace(); panelEndGame.gameObject.SetActive(true); racer.HitStartFinishLine(); } if (!checkpoint.isStartFinishLine && !checkpoint.isFinishLine && tema == 1) { int racerCurrentLap = Random.Range(1, questions_mru.Length); Debug.Log(racerCurrentLap); currentLapAnswer = racerCurrentLap; loadOptionsQuestions(racerCurrentLap, questions_mru, answersOptions_mru); } }