MrGravity.Game_Objects.Physics_Objects.Player.Rumble C# (CSharp) Method

Rumble() public method

Sets the controller to rumble for the amount of time passed
public Rumble ( double time, GameTime gameTime ) : void
time double The amount of time to rumble
gameTime Microsoft.Xna.Framework.GameTime The current gameTime
return void
        public void Rumble(double time, GameTime gameTime)
        {
            var mTime = time;

            for (var i = 0; i < 4; i++)
            {
                var current = (PlayerIndex)Enum.ToObject(typeof(PlayerIndex), i);

                GamePad.SetVibration(current, 1.0f, 1.0f);

                if ((_elapsedTime += gameTime.ElapsedGameTime.TotalSeconds) >= mTime)
                {
                    _mRumble = false;
                    GamePad.SetVibration(current, 0.0f, 0.0f);
                    _elapsedTime = 0.0;
                    MCurrentTexture = PlayerFaces.FromString("Smile");
                }
            }
        }