public void StartRace() { string key = PlayerPrefsKeys.GetTimeTrialHighscoreKey(SceneManager.GetActiveScene()); parkingSpot.OnPlayerParkingEnter.AddListener(FinishRace); stopwatch.Start(); running = true; }
public bool Start() { if (IsStopped) { // Change game part when starting the initial kickoff if (!IsInitialPartKickOffDone) { // Update game part and kickoff info IsInitialPartKickOffDone = true; LastTeamToKickOff = _nextTeamToKickOff; _initialPartTime = DateTime.Now; // Send new game part command switch (GamePart) { case GameParts.PreFirstHalf: SendCommand(Commands.FIRST_HALF); GamePart = GameParts.FirstHalf; break; case GameParts.PreSecondHalf: SendCommand(Commands.SECOND_HALF); GamePart = GameParts.SecondHalf; break; case GameParts.PreFirstHalfOvertime: SendCommand(Commands.FIRST_HALF_OVERTIME); GamePart = GameParts.FirstHalfOvertime; break; case GameParts.PreSecondHalfOvertime: SendCommand(Commands.SECOND_HALF_OVERTIME); GamePart = GameParts.SecondHalfOvertime; break; } } IsChangingScore = false; GameStopwatch.Start(); SendCommand(Commands.START); } return(IsStopped); }