// Use the "most recently set" haptic state for each of light bar/motor. private void setHapticState() { DS4Color lightBarColor = LightBarColor; byte lightBarFlashDurationOn = LightBarOnDuration, lightBarFlashDurationOff = LightBarOffDuration; byte rumbleMotorStrengthLeftHeavySlow = LeftHeavySlowRumble, rumbleMotorStrengthRightLightFast = rightLightFastRumble; int hapticLen = hapticState.Length; for (int i = 0; i < hapticLen; i++) { DS4HapticState haptic = hapticState[i]; if (i == hapticStackIndex) { break; // rest haven't been used this time } if (haptic.IsLightBarSet()) { lightBarColor = haptic.LightBarColor; lightBarFlashDurationOn = haptic.LightBarFlashDurationOn; lightBarFlashDurationOff = haptic.LightBarFlashDurationOff; } if (haptic.IsRumbleSet()) { rumbleMotorStrengthLeftHeavySlow = haptic.RumbleMotorStrengthLeftHeavySlow; rumbleMotorStrengthRightLightFast = haptic.RumbleMotorStrengthRightLightFast; } } LightBarColor = lightBarColor; LightBarOnDuration = lightBarFlashDurationOn; LightBarOffDuration = lightBarFlashDurationOff; LeftHeavySlowRumble = rumbleMotorStrengthLeftHeavySlow; RightLightFastRumble = rumbleMotorStrengthRightLightFast; }
private void setTestRumble() { if (testRumble.IsRumbleSet()) { pushHapticState(testRumble); if (testRumble.RumbleMotorsExplicitlyOff) { testRumble.RumbleMotorsExplicitlyOff = false; } } }