/// <summary> /// Vibrates the current controller, if it exists /// </summary> /// <param name="settings">The settings of the vibration</param> public static void VibrateController(VibrationSettings settings) { Gamepad pad = Gamepad.current; if (pad == null) { return; } WSoft.Core.GameManager gameManager = WSoft.Core.GameManager.Instance; if (gameManager == null) { Debug.LogError("Game Manager does not exist in current scene"); return; } gameManager.StartCoroutine(VibrateControllerCoroutine(pad, settings)); }
/// <summary> /// Vibrates the controller at the specified index, if it exists /// </summary> /// <param name="index">The index to vibrate the controller</param> /// <param name="settings">The settings of the vibration</param> public static void VibrateController(int index, VibrationSettings settings) { UnityEngine.InputSystem.Utilities.ReadOnlyArray <Gamepad> pads = Gamepad.all; if (index >= pads.Count) { Debug.LogError("Controller at index " + index + " not found."); return; } Gamepad currentGamepad = pads[index]; WSoft.Core.GameManager gameManager = WSoft.Core.GameManager.Instance; if (gameManager == null) { Debug.LogError("Game Manager does not exist in current scene"); return; } gameManager.StartCoroutine(VibrateControllerCoroutine(currentGamepad, settings)); }