Example #1
0
 public void FinishRace()
 {
     RaceEndTime = DateTime.Now;
     RaceFinished?.Invoke(Name, rank, DateTime.Now);
     Running = false;
     Speed   = 0;
 }
Example #2
0
 private void FinishRace()
 {
     _timer.Stop();
     _timer.Elapsed -= OnTimedEvent;
     RaceFinished?.Invoke(this, new RaceFinishedEventArgs(GetFinishedPlacements()));
     if (DriversChanged != null)
     {
         foreach (Delegate d in DriversChanged.GetInvocationList())
         {
             DriversChanged -= (EventHandler <DriversChangedEventArgs>)d;
         }
     }
 }
Example #3
0
        //stop race
        public void Stop()
        {
            _timer.Stop();
            SaveTimeBroken();
            RaceFinished?.Invoke(this, new RaceFinishedArgs()
            {
                Eindstand = eindstand, Track = Track
            });

            // ask if they want to see the next race
            string tekst = Console.ReadLine();

            while (tekst != "y")
            {
                tekst = Console.ReadLine();
            }
            StartNextRace?.Invoke(this, EventArgs.Empty);
        }
    private void OnTriggerEnter(Collider other)
    {
        if (other.transform.root.tag == "Player" && IsEnabled)
        {
            Debug.Log($"Checkpoint reached: {gameObject.name}");

            if (nextCheckpoint != null)
            {
                nextCheckpoint.IsEnabled = true;
            }

            if (isFinishLine && !isRaceFinished)
            {
                isRaceFinished = true;
                Debug.Log("Race finished!");
                RaceFinished?.Invoke();
            }
        }
    }