示例#1
0
        public void PlayFallSound()
        {
            m_character.CurrentMovementState(MyCharacterMovementEnum.Standing);
            var walkSurfaceMaterial = RayCastGround();

            if (walkSurfaceMaterial != MyStringHash.NullOrEmpty && MyMaterialPropertiesHelper.Static != null)
            {
                var cue = MyMaterialPropertiesHelper.Static.GetCollisionCue(MovementSoundType.Fall, m_characterPhysicalMaterial, walkSurfaceMaterial);
                if (cue.SoundId.IsNull == false)
                {
                    var emitter = MyAudioComponent.TryGetSoundEmitter(); //we need to use other emmiter otherwise the sound would be cut by silence next frame
                    if (emitter != null)
                    {
                        emitter.Entity = m_character;
                        emitter.PlaySingleSound(cue);
                    }
                }
            }
        }