Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PersistentAudio audio = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentAudio>();

        if (audio.isPlaying != toPlay)
        {
            audio.ChangeMusic(toPlay);
        }
    }
Esempio n. 2
0
 public void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }