Exemple #1
0
        static public void Play3DSoundOnece(SoundEffect soundEffect, Vector2 direction)
        {
            if (soundEffect == null)
            {
                return;
            }

            SoundEffectInstance instance;
            var hash = soundEffect.GetHashCode();

            if (_soundEffectInstances.ContainsKey(hash))
            {
                instance = _soundEffectInstances[hash];
            }
            else
            {
                instance = soundEffect.CreateInstance();
                _soundEffectInstances[hash] = instance;
            }
            Apply3D(instance, direction);
            instance.Play();
        }