public void PlayLoopingSFX(AudioClip sfx, float volume = 1.0f) { if (sfx != null) { if (m_AudioSourceLoopingSFX == null) { GameObject audioSourceLoopingSfxObject = new GameObject("audioSource_LoopingSFX"); audioSourceLoopingSfxObject.transform.parent = transform; m_AudioSourceLoopingSFX = audioSourceLoopingSfxObject.AddComponent <AudioSourceMulti>(); } m_AudioSourceLoopingSFX.Looping = true; m_AudioSourceLoopingSFX.Play(sfx, volume); } }
public void PlaySFX(AudioClip sfx, float volume, float delay) { if (sfx != null) { if (m_AudioSourceSFX == null) { GameObject audioSourceSfxObject = new GameObject("audioSource_SFX"); audioSourceSfxObject.transform.parent = transform; m_AudioSourceSFX = audioSourceSfxObject.AddComponent <AudioSourceMulti>(); } m_AudioSourceSFX.Looping = false; m_AudioSourceSFX.Play(sfx, volume, delay); } }