Esempio n. 1
0
    public void FadeSound(SoundIDs id)
    {
        Sound s = FindS(id);

        if (s.Source.isPlaying && !s.fading)
        {
            StartCoroutine(DoFade(s));
        }
    }
Esempio n. 2
0
 private AudioSource FindSound(SoundIDs id)
 {
     foreach (var s in sounds)
     {
         if (s.Id == id)
         {
             return(s.Source);
         }
     }
     return(null);
 }
Esempio n. 3
0
 private Sound FindS(SoundIDs id)
 {
     foreach (var s in sounds)
     {
         if (s.Id == id)
         {
             return(s);
         }
     }
     return(null);
 }
Esempio n. 4
0
 public void PlayMusic(SoundIDs id)
 {
     foreach (var s in sounds)
     {
         if (s.Id == id)
         {
             musicSource.clip   = s.Clip;
             musicSource.volume = s.Volume;
             musicSource.Play();
             break;
         }
     }
 }
Esempio n. 5
0
    public void PlaySound(SoundIDs id)
    {
        Sound sound = FindS(id);

        if (sound.fading)
        {
            StopCoroutine(DoFade(sound));
            sound.Source.Stop();
            sound.Source.volume = sound.Volume;
        }
        foreach (var s in sounds)
        {
            if (s.Id == id)
            {
                s.Source.Play();
                break;
            }
        }
    }
Esempio n. 6
0
 public void StopSound(SoundIDs id)
 {
     FindSound(id).Stop();
 }