public void StartGame() { int tempIndex = -1; RaceCondition?.Invoke("Race has been started!"); while (!IsFinished) { ShowCarsCondition(); foreach (var car in _cars) { Drive drive = car.Drive; tempIndex = drive(); if (tempIndex != -1) { break; } } Thread.Sleep(1000); Console.Clear(); } FinishRace(tempIndex - 1); }
public void FinishRace(int id) { Console.Clear(); ShowWinner(id); RaceCondition?.Invoke("Race has been finished"); }