private IEnumerator IVibrateController(float vibration, float time) { RInput.SetVibration(0, vibration); RInput.SetVibration(1, vibration); yield return(new WaitForSeconds(time)); RInput.SetVibration(0, 0, true); }
// Update is called once per frame void Update() { Rewired.Player player = ReInput.players.GetPlayer(PlayerId); Debug.Log("MoveH : " + player.GetAxis("MoveH")); Debug.Log("MoveV : " + player.GetAxis("MoveV")); Debug.Log("Flash : " + player.GetButton("Flashlight")); Debug.Log("Inter : " + player.GetButton("Interact")); if (Vibrate) { player.SetVibration(Motor, Speed); } else { player.SetVibration(0, 0, true); } Controller controller = ReInput.controllers.GetController(ControllerType.Joystick, 0); }
/// <summary> /// Set the vibration level of a specific motor on each controller for this player /// </summary> /// <param name="_motorIndex">The index of the motor to vibrate (greater than -1)</param> /// <param name="_level">The level of vibration for the motor in range [0, 1]</param> public void SetVibration(int _motorIndex, float _level) { player.SetVibration(_motorIndex, _level); }