void Awake()
    {
        if (GameObjectRemoveHelper.FindAndRemoveGameObject(gameObject, "SoundManager"))
        {
            return;
        }

        if (_instance == null)
        {
            _instance = this;
        }

        AllSources = new List <AudioSource>();
        if (mainSource == null)
        {
            mainSource = CreateNewSource(Loop);
        }

        //        RegisterSource(mainSource);

        if (musicSource == null)
        {
            musicSource = CreateNewSource(true);
        }
        if (musicSource1 == null)
        {
            musicSource1 = CreateNewSource(true);
        }

        DontDestroyOnLoad(gameObject);

        //		Instance.SFXEnabled = CustomPlayerPrefs.SFXEnabled;
        //		Instance.SoundEnabled = CustomPlayerPrefs.BGMEnabled;
    }
示例#2
0
 void Awake()
 {
     if (GameObjectRemoveHelper.FindAndRemoveGameObject(gameObject, "AppController"))
     {
         return;
     }
     DontDestroyOnLoad(this.gameObject);
 }