Exemple #1
0
 void Silence(AudioSource ButThis = null)//function to turn off all tracks BUT the one that is supposed to be active
 {
     AudioSource[] AllThemes = new AudioSource[] { Introduction, Chap1, Chap2Day, Chap2Night, Chap3Altar, Chap3Snake, Sunrise, ObjectGet, Death };
     for (int i = 0; i < AllThemes.GetLength(0); i++)
     {//use the for loop to check each item of the array and turn them off if they are not the 'butthis'
         AudioSource ThisTheme = AllThemes[i];
         if (ThisTheme != ButThis)
         {
             ThisTheme.Stop();
         }
     }
 }