VibrationTest.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using TMPro;
  2. using UnityEngine;
  3. using static API_GSXR_Module_InputSystem_KS;
  4. using static API_GSXR_Slam;
  5. using static ControllerInfoBase;
  6. public class VibrationTest : MonoBehaviour
  7. {
  8. public TMP_InputField input_Amplitude;
  9. public TMP_InputField input_Frequency;
  10. public TMP_InputField input_Time;
  11. public ControllerInfoBase controller;
  12. public void StartVibrate()
  13. {
  14. float amplitude = float.Parse(input_Amplitude.text);
  15. float frequency = float.Parse(input_Frequency.text);
  16. float time = float.Parse(input_Time.text);
  17. if (controller.is_Left)
  18. {
  19. GSXR_Set_ControllerVibrate(0, true, amplitude, frequency, time);
  20. }
  21. else
  22. {
  23. GSXR_Set_ControllerVibrate(1, true, amplitude, frequency, time);
  24. }
  25. }
  26. public void StopVibrate()
  27. {
  28. if (controller.is_Left)
  29. {
  30. GSXR_Set_ControllerVibrate(0, false, 0.5f, 0.5f, 0.5f);
  31. }
  32. else
  33. {
  34. GSXR_Set_ControllerVibrate(1, false, 0.5f, 0.5f, 0.5f);
  35. }
  36. }
  37. }