Exemple #1
0
    public void RestartButton()
    {
        //Reset all parameters and start game again

        //Search for all asteroids and destroy them
        AsteroidScript[] asteroids = FindObjectsOfType <AsteroidScript>();
        for (int i = 0; i < asteroids.Length; i++)
        {
            Destroy(asteroids[i].gameObject);
        }
        spaceShip.transform.position = shipStartPosition;
        gameOverMenu.SetActive(false);
        StartCoroutine("CaroutineStarter");
        road.StartGameAgain();
        score          = 0;
        tickScore      = 1;
        scoreText.text = score.ToString();
        spaceShip.RestartGame();
        sounds.ChangeVolume(PlayerPrefs.GetFloat("Volume"));
    }