Beispiel #1
0
        public void OnGamePlay()
        {
            var now = DateTime.Now.Ticks / 10000L;

            foreach (SceneObjectEntity entity in soGroup)
            {
                if (now - entity.bombSound.LastSoundTime >= INTERVAL1)
                {
                    GameAudioMedia.PlayUniqueEventAudio(entity.position.Value, EAudioUniqueId.C4_Alarm);
                    entity.bombSound.LastSoundTime = now;
                }
            }

            foreach (FreeMoveEntity entity in fmGroup)
            {
                var interval = INTERVAL3;
                if (now - entity.bombSound.CreateTime <= 24000L)
                {
                    interval = INTERVAL1;
                }
                else if (now - entity.bombSound.CreateTime <= 30000L)
                {
                    interval = INTERVAL2;
                }

                if (now - entity.bombSound.LastSoundTime >= interval)
                {
                    GameAudioMedia.PlayUniqueEventAudio(entity.position.Value, EAudioUniqueId.C4_Alarm);
                    entity.bombSound.LastSoundTime = now;
                }
            }
        }
Beispiel #2
0
        private void PlaySprayAudio()
        {
            Vector3 position = _contexts.player.flagSelfEntity.position.Value;

            GameAudioMedia.PlayUniqueEventAudio(position, EAudioUniqueId.UI_battle_spray);
            /*_contexts.player.flagSelfEntity.AudioController().PlaySimpleAudio(EAudioUniqueId.UI_battle_spray, false);*/
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contexts"></param>
        /// <param name="entity"></param>
        /// <param name="e"></param>
        public override void DoEventClient(Entitas.IContexts contexts, IEntity entity, IEvent e)
        {
            if ((entity as PlayerEntity).isFlagSelf)
            {
                return;
            }

            //  var controller = (entity as PlayerEntity).AudioController();
            AudioEvent audioEvent = e as AudioEvent;

            //     DebugUtil.MyLog("Play event :"+audioEvent.EventType);
            switch (audioEvent.EventType)
            {
            case EEventType.AFootstep:
                GameAudioMedia.PlayFootstepAudio(audioEvent as AudioFootstepEvent);
                break;

            case EEventType.AJumpstep:
                GameAudioMedia.PlayJumpstepAudio(audioEvent as AudioJumpstepEvent);
                break;

            case EEventType.AWeaponFire:
                GameAudioMedia.PlayWeaponFireAudio(audioEvent as AudioWeaponFireEvent);
                break;

            case EEventType.ADefault:
                GameAudioMedia.PlayUniqueEventAudio(audioEvent as AudioDefaultEvent);
                break;

            case EEventType.APullbolt:
                GameAudioMedia.PlayWeaponReloadAudio(audioEvent as AudioPullboltEvent);
                break;

            default:
                break;
            }


            // GameAudioMedium.ProcessWeaponAudio(playerEntity,allContexts,(item)=>item.Fire);
            // if (playerEntity.appearanceInterface.Appearance.IsFirstPerson)
            // {

            // }
            // else
            // {
            ////     GameAudioMedium.PerformOnGunFire();
            // }
        }
Beispiel #4
0
        public void Handle(SimpleProto data)
        {
            if (data.Ks[0] == 0)
            {
                //使用物品声音
                PlayerEntity player = SingletonManager.Get <FreeUiManager>().Contexts1.player.flagSelfEntity;
                if (player != null)
                {
                    var uniqueId = AudioUtil.ToUseItemAudioUniqueId(data.Ins[0]);
                    player.AudioController().PlaySimpleAudio(uniqueId, true);
                }
            }

            if (data.Ks[0] == 1)
            {
                //游戏开始关闭环境音
                MapAmbInfo ambInfo;
                Wwise_IDs.GetMapAmb(data.Ins[0], out ambInfo);
                ambInfo.StopAmb();
            }

            if (data.Ks[0] == 2)
            {
                //播放指定编号的音效
                PlayerEntity player = SingletonManager.Get <FreeUiManager>().Contexts1.player.flagSelfEntity;
                if (player != null)
                {
                    player.AudioController().PlaySimpleAudio((EAudioUniqueId)data.Ins[0], data.Bs[0]);
                }
            }

            if (data.Ks[0] == 3)
            {
                var vc = new Vector3(data.Fs[0], data.Fs[1], data.Fs[2]);
                //在指定位置上播放指定编号的音效
                GameAudioMedia.PlayUniqueEventAudio(vc.ShiftedPosition(), (EAudioUniqueId)data.Ins[0]);
            }
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contexts"></param>
        /// <param name="entity"></param>
        /// <param name="e"></param>
        public override void DoEventClient(Entitas.IContexts contexts, IEntity entity, IEvent e)
        {
            if (SharedConfig.IsMute)
            {
                return;
            }
            //var controller = (entity as PlayerEntity).AudioController();
            var targetPlayerEntity = entity as PlayerEntity;
            int cmrEntityId        = (contexts as Contexts).player.flagSelfEntity.gamePlay.CameraEntityId;
            // foreach(PlayerEntity playerEntity in (contexts as Contexts).player.GetEntities())
            // {
            //    if(playerEntity.gamePlay.CameraEntityId == player.entityKey.Value.EntityId)
            //     {
            //         //TODO
            //         observePlayer = playerEntity;
            //         break;
            //     }
            // }

            AudioEvent audioEvent = e as AudioEvent;

            //DebugUtil.MyLog("Play other event :"+audioEvent.EventType);
            switch (audioEvent.EventType)
            {
            case EEventType.AFootstep:
                GameAudioMedia.PlayFootstepAudio(audioEvent as AudioFootstepEvent);
                break;

            case EEventType.AJumpstep:
                GameAudioMedia.PlayJumpstepAudio(audioEvent as AudioJumpstepEvent);
                break;

            case EEventType.AWeaponFire:
                GameAudioMedia.PlayWeaponFireAudio(audioEvent as AudioWeaponFireEvent);
                break;

            case EEventType.ADefault:
                if (cmrEntityId == targetPlayerEntity.entityKey.Value.EntityId)
                {
                    float RTPCvalue = 1;
                    GameAudioMedia.PlayUniqueEventAudio(audioEvent as AudioDefaultEvent, RTPCvalue);
                    break;
                }
                else
                {
                    float RTPCvalue = 0;
                    GameAudioMedia.PlayUniqueEventAudio(audioEvent as AudioDefaultEvent, RTPCvalue);
                    break;
                }

            case EEventType.APullbolt:
                GameAudioMedia.PlayWeaponReloadAudio(audioEvent as AudioPullboltEvent);
                break;

            case EEventType.AMeleeAttack:
                GameAudioMedia.PlayMeleeAttackAudio(audioEvent as AudioMeleeAtkEvent);
                break;

            default:
                break;
            }


            // GameAudioMedium.ProcessWeaponAudio(playerEntity,allContexts,(item)=>item.Fire);
            // if (playerEntity.appearanceInterface.Appearance.IsFirstPerson)
            // {

            // }
            // else
            // {
            ////     GameAudioMedium.PerformOnGunFire();
            // }
        }