public static void SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor) { if ((int)playerIndex < 0 || (int)playerIndex > 3) { return; } if (leftMotor < 0f) { leftMotor = 0f; } if (rightMotor < 0f) { rightMotor = 0f; } #if WINDOWS_UWP GamepadVibration vibration = new GamepadVibration(); vibration.LeftMotor = leftMotor; vibration.RightMotor = rightMotor; Gamepad.Gamepads[(int)playerIndex].Vibration = vibration; #else XInputDotNetPure.GamePad.SetVibration((XInputDotNetPure.PlayerIndex)playerIndex, leftMotor, rightMotor); #endif GamePadVibration.Vibrations[(int)playerIndex].leftMotor = leftMotor; GamePadVibration.Vibrations[(int)playerIndex].rightMotor = rightMotor; }
public TestVibration(GamepadVibration p) { this.LeftMotor = p.LeftMotor; this.RightMotor = p.RightMotor; this.LeftTrigger = p.LeftTrigger; this.RightTrigger = p.RightTrigger; }
/// <summary> /// SetRightTrigger will change the amount of vibration set for the right trigger on an Xbox controller. /// A value between 0 and 100 is expected to be passed. /// </summary> public void SetRightTrigger(double d) { GamepadVibration vibration = new GamepadVibration(); vibration.RightTrigger = d / 100; Controller.Vibration = vibration; }
/// <summary> /// SetLeftVibration will change the amount of vibration set for the left motor on an Xbox controller. /// A value between 0 and 100 is expected to be passed. /// </summary> public void SetLeftVibration(double d) { GamepadVibration vibration = new GamepadVibration(); vibration.LeftMotor = d / 100; Controller.Vibration = vibration; }
/// <summary> /// SetRightVibration will change the amount of vibration set for the right motor on an Xbox controller. /// A value between 0 and 100 is expected to be passed. /// </summary> public void SetRightVibration(double d) { System.Diagnostics.Debug.WriteLine("HERE"); GamepadVibration vibration = new GamepadVibration(); vibration.RightMotor = d / 100; Controller.Vibration = vibration; }
public void JoystickVibrate(int index, float left, float right) { try { GamepadVibration vibration = new GamepadVibration(); vibration.LeftMotor = (double)left; vibration.RightMotor = (double)right; Gamepad.Gamepads[index].Vibration = vibration; } catch { } }
public GamepadVibration ToGamepadVibration() { GamepadVibration vibration = new GamepadVibration() { LeftMotor = this.LeftMotor, RightMotor = this.RightMotor, LeftTrigger = this.LeftTrigger, RightTrigger = this.RightTrigger }; return(vibration); }
/// <summary> /// コントローラー振動機能 /// </summary> /// <param name="rPower"></param> /// <param name="lPower"></param> public void SetVibration(float rPower, float lPower) { #if WINDOWS_UWP if (gamepad != null) { GamepadVibration gamepadVibration = new GamepadVibration(); gamepadVibration.LeftMotor = rPower; gamepadVibration.RightMotor = lPower; gamepad.Vibration = gamepadVibration; } #endif }
/// <summary> /// Vibrate the controller according to data provided. /// </summary> /// <param name="leftMotor">The strength of vibration in values between 0 and 1.</param> /// <param name="leftTrigger">The strength of vibration in values between 0 and 1.</param> /// <param name="rightMotor">The strength of vibration in values between 0 and 1.</param> /// <param name="rightTrigger">The strength of vibration in values between 0 and 1.</param> /// <param name="time">Time in milliseconds to vibrate.</param> private async void VibrateController(double leftMotor, double leftTrigger, double rightMotor, double rightTrigger, int time) { var vibration = new GamepadVibration { LeftMotor = leftMotor, LeftTrigger = leftTrigger, RightMotor = rightMotor, RightTrigger = rightTrigger }; _controller.Vibration = vibration; await Task.Delay(TimeSpan.FromMilliseconds(time)); vibration.LeftMotor = 0; vibration.RightMotor = 0; _controller.Vibration = vibration; }
public async Task Vibrate() { if (_running) { foreach (Gamepad controller in _controllers) { GamepadVibration gv = new GamepadVibration(); gv.LeftMotor = 1; gv.RightMotor = 1; controller.Vibration = gv; await Task.Delay(1000); gv.LeftMotor = 0; gv.RightMotor = 0; controller.Vibration = gv; } } }
private void On_GamepadAdded(object sender, Gamepad g) { gamepad = Gamepad.Gamepads?.First(); vibration = new GamepadVibration(); timer = ThreadPoolTimer.CreatePeriodicTimer(ImpulsePulseTest, TimeSpan.FromMilliseconds(1000)); }