public AudioClip GetClip(string clipPath, bool common) { AudioClipPath clip = _clips.FirstOrDefault(x => x.path == clipPath && (common || x.langCode == TextManager.instance.currentLang.code)); if (clip == null) { return(null); } return(clip.audioClip); }
public void StopClip(string clipPath, bool common) { AudioClipPath clip = _clips.FirstOrDefault(x => x.path == clipPath && (common || x.langCode == TextManager.instance.currentLang.code)); if (clip == null) { Debug.LogError(string.Format("No audio for {0} path \"{1}\"", common ? "common" : "", common ? GetCommonClipPath(clipPath) : GetTranslatedClipPath(clipPath))); } else if (clip.audioClip == _audioSource.clip && _audioSource.isPlaying) { _audioSource.Stop(); } }