예제 #1
0
        public override void VTSUpdate(double interpolationHd, float interpolationLd, float elapsedTime)
        {
            _listenerPosition = _cameraManager.ActiveCamera.WorldPosition.Value.AsVector3();
            //Set current camera Position
            _soundEngine.SetListenerPosition(_listenerPosition, _cameraManager.ActiveCamera.LookAt.Value);
            //Update All sounds currently playing following new player position (For 3D Sounds)
            _soundEngine.Update3DSounds();

            //Get current player chunk
            VisualChunk chunk;

            if (!_worldChunk.GetSafeChunk(MathHelper.Floor(_playerEntityManager.Player.Position.X), MathHelper.Floor(_playerEntityManager.Player.Position.Z), out chunk))
            {
                return;
            }

            //Always active background music linked to player Mood + Time
            MoodSoundProcessing(_playerEntityManager.Player);

            //Activate Ambiant sounds following player positions, biomes, times, ...
            if (_biomesParams != null)
            {
                AmbiantSoundProcessing(chunk, _playerEntityManager.Player);
            }

            //Walking step sound processing
            WalkingSoundProcessing();

            try
            {
                StaticEntitiesEmittedSoundProcessing();
            }
            catch (InvalidOperationException x)
            {
                logger.Error("Error when processing static sounds: {0}", x.Message);
            }
        }