private void OnApplicationQuit() { SpaceNav.Instance.CloseDevice(); StopCoroutine("DoWaitEvent"); StopCoroutine("ArduinoEvent"); // Reset position of robotic arm fingers.Clear(); fingers.Add(auriculaire); fingers.Add(ringFinger); fingers.Add(middleFinger); fingers.Add(index); fingers.Add(thumb); /* foreach(var finger in fingers) * { * connector.MoveFinger(finger.Key, 120); * }*/ byte fingersMask = 0; foreach (var finger in fingers) { fingersMask |= finger.mask; //connector.MoveFinger(finger.Key, (int)finger.Value.degree); } connector.MoveFinger(fingersMask, 120); connector.Close(); }
public bool pushing = false; //This is handle for pushing received by arduino > send to 'Bird.cs' void Awake() { //If we don't currently have a game control... if (instance == null) { //...set this one to be it... instance = this; connect.Open(); } //...otherwise... else if (instance != this) { //...destroy this one because it is a duplicate. Destroy(gameObject); connect.Close(); } }