public void SendRumble(InputRumbleMotor Motor, byte Strength, int Duration) { if (Connected) { switch (Motor) { case InputRumbleMotor.Left: Controller.Rumble(0, (byte)Strength, Duration); break; case InputRumbleMotor.Right: Controller.Rumble((byte)Strength, 0, Duration); break; case InputRumbleMotor.Both: Controller.Rumble((byte)Strength, (byte)Strength, Duration); break; } } }
public void SendRumble(InputRumbleMotor Motor, byte Strength, int Duration) { if (controller != null && controller.IsConnected) { var strengthVal = (ushort)(((float)Strength / 255f) * ushort.MaxValue); switch (Motor) { case InputRumbleMotor.Left: controller.SetVibration(new Vibration() { LeftMotorSpeed = strengthVal }); break; case InputRumbleMotor.Right: controller.SetVibration(new Vibration() { RightMotorSpeed = strengthVal }); break; case InputRumbleMotor.Both: controller.SetVibration(new Vibration() { LeftMotorSpeed = strengthVal, RightMotorSpeed = strengthVal }); break; } Thread.Sleep(Duration); controller.SetVibration(new Vibration() { RightMotorSpeed = 0, LeftMotorSpeed = 0 }); } }