/// <summary> /// Updates the position and velocity settings of a 3D cue. /// </summary> private void Apply3D(Sound3D cue3D) { emitter.Position = cue3D.Emitter.Position; emitter.Forward = cue3D.Emitter.Forward; emitter.Up = cue3D.Emitter.Up; emitter.Velocity = cue3D.Emitter.Velocity; cue3D.Sound.Apply3D(listener, emitter); }
/// <summary> /// Создает кнопку с указанным изображением /// </summary> public Button(MultiSprite image, Sound3D soundClick, Sound3D soundSelection, SpriteFont font) : base(image) { this.soundSelection = soundSelection; this.soundClick = soundClick; this.font = font; this.text = "button"; this.textPos = new Vector2(Bounds.X + Bounds.Width / 2, Bounds.Y + Bounds.Height / 2) - font.MeasureString(text) / 2; Animation = false; this.MouseMoveIn += new EventHandler <MouseElementEventArgs>(Button_MouseMoveIn); this.Click += new EventHandler <MouseElementEventArgs>(Button_Click); initPos = Position; initSize = Size; }
/// <summary> /// Triggers a new 3D sound /// </summary> /// <remarks> /// In order to free up unnecessary memory usage, the played cue is automatically destroyed /// when it stops playing. /// </remarks> /// <exception cref="GoblinException">Throws exception if this is called before Initialize(..)</exception> /// <param name="soundEffect">The loaded sound effect</param> /// <param name="emitter">An IAudioEmitter object that defines the properties of the sound /// including position, and velocity.</param> /// <returns></returns> public SoundEffectInstance PlaySoundEffect3D(SoundEffect soundEffect, IAudioEmitter emitter) { SoundEffectInstance ei = soundEffect.CreateInstance(); Sound3D sound3D = new Sound3D(); sound3D.Sound = ei; sound3D.Emitter = emitter; sound3Ds.Add(sound3D); Apply3D(sound3D); ei.Play(); return(ei); }