Beispiel #1
0
    void Awake()
    {
        //if we don't currently have a game control...
        if (current == null)
        {
            //...set this one to be it...
            current = this;
        }
        //...otherwise...
        else if (current != this)
        {
            //...destroy this one because it is a duplicate
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        foreach (string aName in Constants.AUDIO_NAME)
        {
            AudioClip aClip = Resources.Load(Constants.RESOURCELOCATION_AUDIO + aName) as AudioClip;
            audioDict.Add(aName, aClip);
        }

        isMusicOn = PlayerPrefs.GetInt(musicToggle, 1) == 1;
        isSoundOn = PlayerPrefs.GetInt(soundToggle, 1) == 1;
    }
Beispiel #2
0
    void Awake()
    {
        //if we don't currently have a game control...
        if (current == null)
            //...set this one to be it...
            current = this;
        //...otherwise...
        else if(current != this)
            //...destroy this one because it is a duplicate
            Destroy (gameObject);

        DontDestroyOnLoad (gameObject);

        foreach(string aName in Constants.AUDIO_NAME){
            AudioClip aClip= Resources.Load(Constants.RESOURCELOCATION_AUDIO+aName) as AudioClip;
            audioDict.Add (aName, aClip);
        }

        isMusicOn = PlayerPrefs.GetInt (musicToggle, 1)==1;
        isSoundOn = PlayerPrefs.GetInt (soundToggle, 1)==1;
    }