Esempio n. 1
0
 // Start is called before the first frame update
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        restartButton.SetActive(false);

        gameStopped    = false;
        Time.timeScale = 1f;
        highScore      = PlayerPrefs.GetInt("highScore");
        nextSpawn      = Time.time + spawnRate;
        nextBoost      = Time.unscaledTime + timeToBoost;
        marks          = PlayerPrefs.GetInt("marks");
        PlayerPrefs.SetInt("marks", marks);
        timetaken = Time.time;
        yourScore = PlayerPrefs.GetInt("yourScore");
    }