void OnDestroy() { if (deviceController != null && deviceController.GetDevice() != null) { CVirtDevice virtDevice = deviceController.GetDevice(); if (virtDevice.HasHaptic()) { virtDevice.HapticStop(); } } }
public void OnCVirtDeviceControllerCallback(CVirtDevice virtDevice, CVirtDeviceController.CVirtDeviceControllerCallbackType callbackType) { switch (callbackType) { case CVirtDeviceController.CVirtDeviceControllerCallbackType.Connect: virtDevice.HapticSetGain(4); virtDevice.HapticSetFrequency(60); virtDevice.HapticSetVolume(0); // virtDevice.HapticPlay(); break; case CVirtDeviceController.CVirtDeviceControllerCallbackType.Disconnect: virtDevice.HapticStop(); break; } }