/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~其他~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /// <summary> /// 忽视距离声音 /// </summary> public SoundBase PlayIgnoreListenerSound(string fileName, int count = 1) { if (IsCloseEffectSound || fileName.Length == 0) { return(null); } EffectSound sound = CommonObjectPools.Spawn <EffectSound>(); sound.Setup(fileName, Vector3.zero, GetDefaultListener().transform, 0, 500, count); sound.LoadResource(); return(sound); }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~音效~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /// <summary> /// 音效 /// </summary> /// <param name="fileName">资源文件</param> /// <param name="pos">播放位置</param> /// <param name="loop">是否循环:如果是循环音效,需要手动清理(AudioSourcePools.instance.DespawnAudio)</param> /// <returns></returns> public SoundBase PlaySoundEffect(string fileName, Vector3 pos, float min_distance, float max_distance, int count = 1) { if (IsCloseEffectSound || fileName.Length == 0) { return(null); } EffectSound sound = CommonObjectPools.Spawn <EffectSound>(); sound.Setup(fileName, pos, null, min_distance, max_distance, count); sound.LoadResource(); return(sound); }