protected bool WriteHaptics(int[] brakeLvls, int[] buzzLvls, int thumperEffect) { if (linkedGlove != null && linkedGlove.IsConnected()) { bool sent = linkedGlove.SendHaptics(brakeLvls, buzzLvls, (ThumperEffect)thumperEffect); if (sent) { lastBrakeLvls = new int[brakeLvls.Length]; for (int i = 0; i < lastBrakeLvls.Length; i++) { lastBrakeLvls[i] = brakeLvls[i]; } //deep copy lastBuzzLvls = new int[buzzLvls.Length]; for (int i = 0; i < lastBuzzLvls.Length; i++) { lastBuzzLvls[i] = buzzLvls[i]; } //deep copy lastThump = thumperEffect; nextThump = (int)ThumperEffect.None; } return(sent); } return(false); }
/// <summary> Dispose of resources. </summary> private void Dispose() { this.CancelCalibration(); if (glove != null && glove.IsConnected()) { glove.StopBrakes(); glove.StopBuzzMotors(); glove.Disconnect(); SenseGlove_Debugger.Log("Disconnected the SenseGlove on " + glove.communicator.Address()); } this.Disconnect(); }
// OnApplicationQuit is called when the game shuts down. void OnApplicationQuit() { this.CancelCalibration(); if (glove != null && glove.IsConnected()) { glove.SimpleBrakeCmd(0, 0, 0, 0, 0); glove.Disconnect(); SenseGlove_Debugger.Log("Disconnected the SenseGlove on " + glove.communicator.Address()); } SenseGloveCs.DeviceScanner.CleanUp(); }