Пример #1
0
    /// <summary>
    /// Execute the correct vibration method for the type of joystick
    /// </summary>
    /// <param name="lS">The left strength of the rumble</param>
    /// <param name="rS">the right strength of the rumble</param>
    private void VibrateForJoystickType(Joystick joystick, float lS, float rS)
    {
        // Get the Dual Shock 4 Controller Extension from the Joystick
        var ds4 = joystick.GetExtension<Rewired.ControllerExtensions.DualShock4Extension>();

        if (ds4 != null)
        {
            ds4.SetVibration(lS, rS);
        }
        else
        {
            joystick.SetVibration(lS, rS);
        }
    }