internal static void Play(AudioClipEx clip, ref AudioSource audioSource) { if (audioSource != null) { audioSource.Stop(); } audioSource = Play(clip); }
private IEnumerator CoPlayClip(AudioClipEx clip) { source.loop = false; source.outputAudioMixerGroup = clip.mixer ?? source.outputAudioMixerGroup; // using play one shot so can play multiple at the same time. such as kick and land source.PlayOneShot(clip.clip, clip.volume); yield return(new WaitForSeconds(clip.clip.length)); _playingOneshot = false; }
internal static AudioSource Play(AudioClipEx clip) { if (clip.Sound != null) { AudioSource audioSource = Audio.Instance.PlaySound(clip.Sound, clip.Volume, clip.Delay, clip.Pitch); if (audioSource != null) { audioSource.loop = clip.IsLooping; } return(audioSource); } else { return(null); } }
internal static void Play(AudioClipEx clip, AudioSource source) { if (clip.Sound != null) { source.clip = clip.Sound; source.volume = clip.Volume; source.loop = clip.IsLooping; source.pitch = clip.Pitch; if (clip.Delay > 0) { source.PlayDelayed(clip.Delay); } else { source.Play(); } } }