Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        ust        = GameObject.Find("Ustawienia").GetComponent <Ustawienia> ();
        textDzwiek = GameObject.Find("SoundButton").GetComponentInChildren <Text> ();
        textMuzyka = GameObject.Find("MusicButton").GetComponentInChildren <Text> ();
        ust.wlaczMuzyke(menuMusic);

        clicks = 0;

        if (!PlayerPrefs.HasKey("Points"))          // Ustawianie zmiennej odpowiedzialnej za ogólne punkty
        {
            PlayerPrefs.SetInt("Points", 0);
        }

        if (!PlayerPrefs.HasKey("FirstTime"))          // Sprawdzanie, czy gra została włączona po raz pierwszy na urządzeniu
        {
            PlayerPrefs.SetInt("FirstTime", 1);
        }
        else
        {
            PlayerPrefs.SetInt("FirstTime", 0);
        }

        if (PlayerPrefs.GetInt("Dzwiek") == 0)         // Ustawianie tekstu na przycisku dźwięku
        {
            textDzwiek.text = "DŹWIĘK: OFF";
        }

        if (PlayerPrefs.GetInt("Muzyka") == 0)         // Ustawianie tekstu na przycisku muzyki
        {
            textMuzyka.text = "MUZYKA: OFF";
        }
    }
Exemplo n.º 2
0
    Ustawienia settings; // ustawienia dźwięku, muzyki i odgrywanie dźwięków

    // Use this for initialization
    void Start()
    {
        settings      = GameObject.FindWithTag("Ustawienia").GetComponent <Ustawienia> ();
        gAnim         = GetComponent <Animator> ();
        newRecordAnim = GameObject.Find("NewRecordText").GetComponent <Animator> ();
        myRigidbody   = GetComponent <Rigidbody2D>();
        crowd         = GameObject.FindGameObjectWithTag("Tlum").GetComponent <Transform>();
        scoreValue    = 0f;                  //zerowanie wyniku
        settings.wlaczMuzyke(gameMusic);
        highscoreText.text = "Rekord: " + PlayerPrefs.GetInt("Highscore");
        if (!PlayerPrefs.HasKey("Money"))
        {
            PlayerPrefs.SetInt("Money", 0);
        }
        for (int i = 0; i < upgrades.upgradesArray.Length; i++)
        {
            if (PlayerPrefs.GetInt(upgrades.upgradesArray [i].name) == 0)
            {
                upgradeEnabled [i] = false;
                if (upgrades.upgradesArray [i].upgradeImage != null)
                {
                    upgrades.upgradesArray [i].upgradeImage.gameObject.SetActive(false);
                }
            }
            else
            {
                upgradeEnabled [i] = true;
            }
        }
    }
Exemplo n.º 3
0
 public void pressMuzyka()     // Funkcja odpowiedzialna za kliknięcie przycisku muzyki
 {
     if (PlayerPrefs.GetInt("Muzyka") == 1)
     {
         PlayerPrefs.SetInt("Muzyka", 0);
         textMuzyka.text = "MUZYKA: OFF";
         ust.resetSound();
     }
     else
     {
         PlayerPrefs.SetInt("Muzyka", 1);
         textMuzyka.text = "MUZYKA: ON";
         ust.resetSound();
         ust.wlaczMuzyke(menuMusic);
     }
 }