void countdown() { if (!useCountdown) { StartCoroutine(hideCountdownTimer(0f)); carController.isRunning = true; laptimer.isRunning = true; setAllAICarRunning(true); } else if (timerRunning) { countdownTimer.enabled = true; if (timer >= 0) { timer -= 1 * Time.deltaTime; countdownTimer.text = timer.ToString("0"); startLightRenderer.material.SetFloat("_ShiftValue", 1 - (timer) / maxTimer); } if (timer < 0.5f) { goBeep.Play(); countdownTimer.text = "GO!"; carController.isRunning = true; laptimer.isRunning = true; setAllAICarRunning(true); laptimer.ResetCurrentTime(); StartCoroutine(hideCountdownTimer(1.5f)); timerRunning = false; } if (countdownTimer.text.Equals(timerSound.ToString("0"))) { countdownBeep.Play(); //print(timerSound.ToString("0") + " : " + countdownTimer.text); timerSound--; } } }