예제 #1
0
 IEnumerator RepeatSound(SFXInfo sound, float delay)
 {
     while (true)
     {
         sound.clip.PlaySound(sfx);
         yield return(new WaitForSeconds(sound.clip.clip.length + delay));
     }
 }
 private void button3_Click(object sender, EventArgs e)
 {
     if (listBox2.SelectedIndex != -1)
     {
         SFXInfo temp = (SFXInfo)listBox2.SelectedItem;
         temp.sfx.CreateInstance().Play();
     }
 }
예제 #3
0
 public void StopRepeating(SFXInfo info)
 {
     if (repeating_sounds.ContainsKey(info))
     {
         StopCoroutine(repeating_sounds[info]);
         repeating_sounds.Remove(info);
     }
 }
예제 #4
0
파일: Sound.cs 프로젝트: Bjeck/Eravola
    void Play(SFXInfo sound)
    {
        if (audiosources[poolidx].isPlaying)
        {
            FindNextUnusedSource();
        }

        SetAudioSourceToInfoSettings(audiosources[poolidx], sound);
        audiosources[poolidx].Play();
    }
예제 #5
0
 public void PlaySFX(SFXInfo sfxInfo)
 {
     if (sfxInfo.clip == null)
     {
         return;
     }
     AudioManager.playSFX(
         this, sfxInfo.clip,
         sfxInfo.delay, sfxInfo.volume);
 }
예제 #6
0
파일: Sound.cs 프로젝트: Bjeck/Eravola
 void SetAudioSourceToInfoSettings(AudioSource source, SFXInfo info)
 {
     source.clip   = info.audio;
     source.volume = info.volume;
     source.loop   = info.loop;
     source.pitch  = 1;
     if (info.mixer != null)
     {
         source.outputAudioMixerGroup = info.mixer;
     }
 }
예제 #7
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (listBox2.SelectedIndex != -1)
     {
         SFXInfo temp = new SFXInfo();
         temp.sfxLoc  = sfxLocs[listBox2.SelectedIndex];
         temp.sfxName = listBox2.SelectedItem.ToString();
         temp.ReloadContent();
         temp.sfx.CreateInstance().Play();
     }
 }
예제 #8
0
 public void PlayRepeating(SFXInfo info, float delay = 0)
 {
     if (info == null || info.clip == null)
     {
         return;
     }
     if (repeating_sounds.ContainsKey(info))
     {
         return;
     }
     repeating_sounds.Add(info, StartCoroutine(RepeatSound(info, delay)));
 }
예제 #9
0
파일: Sound.cs 프로젝트: Bjeck/Eravola
    public void Stop(SFXIDS id) //These stops go through the entire list which might be a little cumbersome really.
    {
        SFXInfo inf = sfx[id];

        for (int i = 0; i < audiosources.Count; i++)
        {
            if (audiosources[i].clip == inf.audio)
            {
                audiosources[i].Stop();
            }
        }
    }
예제 #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (button1.Enabled && listBox2.SelectedIndex != -1)
     {
         SFXInfo temp = new SFXInfo();
         temp.sfxLoc  = sfxLocs[listBox2.SelectedIndex];
         temp.sfxName = listBox2.SelectedItem.ToString();
         temp.ReloadContent();
         MapBuilder.gcDB.AddSFX(temp);
         ReloadLB1();
     }
 }
예제 #11
0
 public void PlaySfx(SFXInfo info, bool is_once_per_frame = true)
 {
     if (info == null || info.clip == null)
     {
         return;
     }
     if (is_once_per_frame && clips_played_this_frame.Contains(info.clip))
     {
         return;
     }
     info.clip.PlaySound(sfx);
     clips_played_this_frame.Add(info.clip);
 }
예제 #12
0
파일: Sound.cs 프로젝트: Bjeck/Eravola
    public void Play(SFXIDS sound, bool randomPitch) //This shouldn't be a separate play!!! That's Bad!
    {
        SFXInfo s = sfx[sound];

        if (audiosources[poolidx].isPlaying)
        {
            FindNextUnusedSource();
        }

        SetAudioSourceToInfoSettings(audiosources[poolidx], s);
        if (randomPitch)
        {
            audiosources[poolidx].pitch = Random.Range(0.98f, 1.02f);
        }

        audiosources[poolidx].Play();
    }
예제 #13
0
파일: Sound.cs 프로젝트: Bjeck/Eravola
    /// <summary>
    /// Playing Sacred means that it plays without switching which audio source plays the file. This is good for sound effects that play a lot and never at the same time. For example, text beeping.
    /// </summary>
    /// <param name="sound"></param>
    /// <param name="uniqueID"></param>
    /// <param name="randomPitch"></param>
    public void PlaySacred(SFXIDS sound, UNIQUESOURCES uniqueID, bool randomPitch = false)
    {
        AudioSource source;
        SFXInfo     s = sfx[sound];

        if (!sacredsources.ContainsKey(uniqueID))
        {
            //add it
            source = AddNewAudiosourceToPool();
            sacredsources.Add(uniqueID, source);
        }


        SetAudioSourceToInfoSettings(sacredsources[uniqueID], s);

        if (randomPitch)
        {
            sacredsources[uniqueID].pitch = Random.Range(0.98f, 1.02f);
        }

        sacredsources[uniqueID].Play();
    }
예제 #14
0
 private void PlaySFX(SFXInfo sfx)
 {
     _audioSource.pitch  = Random.Range(sfx.pitchMin, sfx.pitchMax);
     _audioSource.volume = sfx.volume;
     _audioSource.PlayOneShot(sfx.audioClip);
 }
예제 #15
0
파일: Sound.cs 프로젝트: Bjeck/Eravola
    public void PlayRandomFromList(SFXLISTS list)
    {
        SFXInfo s = sfxLists[list].list[Random.Range(0, sfxLists[list].list.Count)];

        Play(s);
    }