예제 #1
0
 /// <summary>
 /// Should be called to reposition a kart to the last checkpoint it passed through.
 /// This must be overriden by a child class and can perform any operation over any period of time but must call RepositionComplete immediately before returning.
 /// </summary>
 /// <param name="lastCheckpoint">The last checkpoint the kart passed through.</param>
 /// <param name="movable">The IMovable implementation representing the kart.</param>
 /// <param name="isControlled">Whether or not the kart is being controlled.  This informs whether control should be re-enabled after the reposition.</param>
 public abstract void Reposition(Checkpoint lastCheckpoint, IMovable movable, bool isControlled);
예제 #2
0
 void RacerHitIncorrectCheckpoint(IRacer racer, Checkpoint checkpoint)
 {
     // No implementation required by template.
 }
예제 #3
0
        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);
            }
        }