コード例 #1
0
        public static PlaySoundEntityInfo Create(GEntity bindingEntity, Vector3 worldPosition, object userData)
        {
            PlaySoundEntityInfo playSoundInfo = ReferencePool.Acquire <PlaySoundEntityInfo>();

            playSoundInfo.m_BindingEntity = bindingEntity;
            playSoundInfo.m_WorldPosition = worldPosition;
            playSoundInfo.m_UserData      = userData;
            return(playSoundInfo);
        }
コード例 #2
0
        public override void OnPlaySoundSuccess(object userData, ISoundAgent soundAgent)
        {
            PlaySoundEntityInfo playSoundInfo = (PlaySoundEntityInfo)userData;

            if (playSoundInfo != null)
            {
                SoundAgentHelperBase soundAgentHelper = (SoundAgentHelperBase)soundAgent.Helper;
                if (playSoundInfo.BindingEntity != null)
                {
                    soundAgentHelper.SetBindingEntity(playSoundInfo.BindingEntity);
                }
                else
                {
                    soundAgentHelper.SetWorldPosition(playSoundInfo.WorldPosition);
                }
            }
        }
コード例 #3
0
ファイル: MonoSound.cs プロジェクト: wangjie0707/Temp_01
 /// <summary>
 /// 播放声音。
 /// </summary>
 /// <param name="soundAssetName">声音资源名称。</param>
 /// <param name="soundGroupName">声音组名称。</param>
 /// <param name="priority">加载声音资源的优先级。</param>
 /// <param name="playSoundParams">播放声音参数。</param>
 /// <param name="worldPosition">声音所在的世界坐标。</param>
 /// <param name="userData">用户自定义数据。</param>
 /// <returns>声音的序列编号。</returns>
 public CFTask <int> PlaySound(string soundAssetName, string soundGroupName, int priority, PlaySoundParams playSoundParams, Vector3 worldPosition, object userData)
 {
     return(m_SoundMethods.PlaySound(soundAssetName, soundGroupName, priority, playSoundParams, PlaySoundEntityInfo.Create(null, worldPosition, userData)));
 }