private void PlayShipSound(ShipEmitters emitter, ShipSystemSoundsEnum sound, bool checkIfAlreadyPlaying = true, bool stopPrevious = true, bool useForce2D = true, bool useFadeOut = false)
        {
            MySoundPair soundPair = GetShipSound(sound);

            if (soundPair == MySoundPair.Empty)
            {
                return;
            }
            if (m_emitters[(int)emitter] != null)
            {
                if (checkIfAlreadyPlaying && m_emitters[(int)emitter].IsPlaying && m_emitters[(int)emitter].SoundPair == soundPair)
                {
                    return;
                }
                if (m_emitters[(int)emitter].IsPlaying && useFadeOut)
                {
                    var effect = MyAudio.Static.ApplyEffect(m_emitters[(int)emitter].Sound, MyStringHash.GetOrCompute("CrossFade"), new MyCueId[] { soundPair.SoundId }, 1500);
                    m_emitters[(int)emitter].Sound = effect.OutputSound;
                }
                else
                {
                    m_emitters[(int)emitter].PlaySound(soundPair, stopPrevious, force2D: useForce2D && m_shouldPlay2D);
                }
            }
        }
        private MySoundPair GetShipSound(ShipSystemSoundsEnum sound)
        {
            if (m_isDebris)
            {
                return(MySoundPair.Empty);
            }
            MyShipSoundsDefinition soundGroup;

            if (m_categories.TryGetValue(m_shipCategory, out soundGroup))
            {
                MySoundPair result;
                if (soundGroup.Sounds.TryGetValue(sound, out result))
                {
                    return(result);
                }
                else
                {
                    return(MySoundPair.Empty);
                }
            }
            else
            {
                return(MySoundPair.Empty);
            }
        }
 private MySoundPair GetShipSound(ShipSystemSoundsEnum sound)
 {
     if (m_isDebris)
         return MySoundPair.Empty;
     MyShipSoundsDefinition soundGroup;
     if (m_categories.TryGetValue(m_shipCategory, out soundGroup))
     {
         MySoundPair result;
         if(soundGroup.Sounds.TryGetValue(sound, out result))
             return result;
         else
             return MySoundPair.Empty;
     }
     else
     {
         return MySoundPair.Empty;
     }
 }
 private void PlayShipSound(ShipEmitters emitter, ShipSystemSoundsEnum sound, bool checkIfAlreadyPlaying = true, bool stopPrevious = true, bool useForce2D = true, bool useFadeOut = false)
 {
     MySoundPair soundPair = GetShipSound(sound);
     if (soundPair == MySoundPair.Empty)
         return;
     if (m_emitters[(int)emitter] != null)
     {
         if (checkIfAlreadyPlaying && m_emitters[(int)emitter].IsPlaying && m_emitters[(int)emitter].SoundPair == soundPair)
             return;
         if (m_emitters[(int)emitter].IsPlaying && useFadeOut)
         {
             var effect = MyAudio.Static.ApplyEffect(m_emitters[(int)emitter].Sound, MyStringHash.GetOrCompute("CrossFade"), new MyCueId[] { soundPair.SoundId }, 1500);
             m_emitters[(int)emitter].Sound = effect.OutputSound;
         }
         else
             m_emitters[(int)emitter].PlaySound(soundPair, stopPrevious, force2D: useForce2D && m_shouldPlay2D);
     }
 }