Exemplo n.º 1
0
 public override void ChangeState(Microsoft.Xna.Framework.Input.MouseState state)
 {
     if (state.LeftButton != ButtonState.Pressed && state.RightButton != ButtonState.Pressed)
     {
         if (_Sprite.Contains(state.X, state.Y))
         {
             _Sprite.CurrentFrame = 1;
         }
         else
         {
             _Sprite.CurrentFrame = 0;
         }
     }
     if (state.LeftButton == ButtonState.Pressed && _Sprite.Contains(state.X, state.Y) && _LastMouseState.LeftButton == ButtonState.Released)
     {
         _Sprite.CurrentFrame = 2;
         if (OnValueChanged != null)
         {
             OnValueChanged();
         }
         float snd = 12 - _Game.SoundVolume();
         if (snd != 12)
         {
             _Sound.Play(1 / snd, 0, 0);
         }
     }
     _LastMouseState = state;
 }
Exemplo n.º 2
0
        private void PlaySound()
        {
            float snd = 12 - _Game.SoundVolume();

            if (snd != 12)
            {
                _Sound.Play(1 / snd, 0, 0);
            }
        }