Exemple #1
0
 public static void SetPosition(Sfx3D sfx, Vector3 position)
 {
     position = new Vector3(position.X, position.Z, position.Y);
     sfx.pos  = position;
     if (sfx.global)
     {
         emitter.Position = Vector3.Transform(position, cameraTransform) * sfx.exponent;
     }
     else
     {
         emitter.Position = position * sfx.exponent;
     }
     sfx.sfx.Apply3D(listener, emitter);
 }
Exemple #2
0
        public static Sfx3D PlaySound3DLocal(string cue, Vector3 position, bool loop = false, float myVolume = 1f, float exponent = 1f)
        {
            position = new Vector3(position.X, position.Z, position.Y);
            Sfx3D sfx = new Sfx3D(ContentLoader.sounds[cue].CreateInstance(), position, myVolume, false);

            sfx.sfx.IsLooped = loop;
            sfx.sfx.Volume   = myVolume * soundVolume;
            sfx.exponent     = exponent;

            sfxInstances.Add(sfx);
            emitter.Position = position * sfx.exponent;

            sfx.sfx.Apply3D(listener, emitter);
            sfx.sfx.Play();

            return(sfx);
        }
Exemple #3
0
        public static Sfx3D PlaySound3DGlobal(string cue, Vector3 position, bool loop = false, float myVolume = 1f, float exponent = 1f)
        {
            position = new Vector3(position.X, position.Z, position.Y);
            Sfx3D sfx = new Sfx3D(ContentLoader.sounds[cue].CreateInstance(), position, myVolume);

            sfx.sfx.IsLooped = loop;
            sfx.sfx.Volume   = myVolume * soundVolume;
            sfx.exponent     = exponent;

            sfxInstances.Add(sfx);
            emitter.Position = Vector3.Transform(position, cameraTransform);
            //float distance = emitter.Position.Length();
            emitter.Position = emitter.Position * sfx.exponent;
            sfx.sfx.Pitch    = 1;

            sfx.sfx.Apply3D(listener, emitter);
            sfx.sfx.Play();

            return(sfx);
        }