private void StopLightFlash() { // This is not supported on PS4 so get the Standalone DualShock4Extension DualShock4Extension ds4 = GetFirstDS4(player) as DualShock4Extension; if (ds4 != null) { ds4.StopLightFlash(); } }
private void StartLightFlash() { // This is not supported on PS4 so get the Standalone DualShock4Extension DualShock4Extension ds4 = GetFirstDS4(player) as DualShock4Extension; if (ds4 != null) { ds4.SetLightFlash(0.5f, 0.5f); // Light flash is handled by the controller hardware itself and not software. // The current value cannot be obtained from the controller so it // cannot be reflected in the 3D model without just recreating the flash to approximate it. } }
void SetControllerColor(Controller controller, DualShock4Extension ds4) { for (int i = 0; i < ReInput.players.playerCount; i++) { if (ReInput.controllers.IsControllerAssignedToPlayer(controller.type, controller.id, i)) { ds4.SetLightColor(playerColors[i]); return; } } ds4.SetLightColor(Color.white); }
void OnApplicationQuit() { if (ReInput.controllers.GetControllers(ControllerType.Joystick) == null) { return; } foreach (Controller controller in ReInput.controllers.GetControllers(ControllerType.Joystick)) { DualShock4Extension ds4 = controller.GetExtension <DualShock4Extension>(); if (ds4 == null) { continue; } ds4.SetLightColor(Color.clear); } }
public void SetupPS4Controllers() { if (ReInput.controllers.GetControllers(ControllerType.Joystick) == null) { return; } foreach (Controller controller in ReInput.controllers.GetControllers(ControllerType.Joystick)) { DualShock4Extension ds4 = controller.GetExtension <DualShock4Extension>(); if (ds4 == null) { continue; } SetControllerColor(controller, ds4); } }