public void Pause() { if (Time.timeScale == 1 && audioManager.carSound.isPlaying == true) { Time.timeScale = 0; audioManager.carSound.Stop(); ui.gameOverActiveted(); } else if (Time.timeScale == 1 && audioManager.maxSpeedSound.isPlaying == true) { Time.timeScale = 0; audioManager.maxSpeedSound.Stop(); ui.gameOverActiveted(); } else if (Time.timeScale == 0 && audioManager.carSound.isPlaying == false) { Time.timeScale = 1; gameOver = false; audioManager.maxSpeedSound.Play(); foreach (Button button in buttons) { button.gameObject.SetActive(false); } } }
private void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Enemy Car") { Destroy(gameObject); // burada objeyi destroy etmek yerine tekrar spawn etmek gerek performans için. ui.gameOverActiveted(); audioManager.carSound.Stop(); audioManager.maxSpeedSound.Stop(); Time.timeScale = 0; // arac carptiginda crash ses efekti eklenmeli. } }