Пример #1
0
 private bool PlayAudio(AudioButton audBtn)
 {
     if ((!AllAtOnce && !audioSource.isPlaying) || AllAtOnce)
     {
         audBtn.Click();
         audioSource.PlayOneShot(audBtn.audioClip);
         return(true);
     }
     return(false);
 }
Пример #2
0
 private bool PlayAudioWithRandomAudioChance(AudioButton audBtn, AudioClip randomAudio, int randNum, int randThreshold)
 {
     if ((!AllAtOnce && !audioSource.isPlaying) || AllAtOnce)
     {
         audBtn.Click();
         if (Random.Range(0, randNum) >= randThreshold)
         {
             audioSource.PlayOneShot(randomAudio);
             RandomAudioPlayedOnce = true;
         }
         else
         {
             audioSource.PlayOneShot(audBtn.audioClip);
         }
         return(true);
     }
     return(false);
 }