/**统一创建接口,不要使用默认的构造函数实现*/ static public DropPhysxObj Create() { DropPhysxObj obj = CommonObjectPools.Spawn <DropPhysxObj>(); obj.Init(); return(obj); }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~其他~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /// <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); }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~背景声音~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /**背景声音*/ public BackgroundSound PlayBGSound(string fileName, bool loop) { if (m_IsCloseBGSound) { return(null); } if (string.IsNullOrEmpty(fileName)) { return(null); } BackgroundSound sound = CommonObjectPools.Spawn <BackgroundSound>(); sound.Setup(fileName, Vector3.zero, null, 0, 0, loop ? int.MaxValue : 1); sound.LoadResource(); m_ListBGAudio.Add(sound); return(sound); }