public IEnumerator GestureCom(int i) { _isPreparing = true; switch (i) { case 1: myHandController.IFlexion(); myHandController.IClose(false); myHandController.isClose = false; myHandController.IPronation(false); TargetHand01.SetActive(true); TargetHand02.SetActive(false); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 2: myHandController.IExtension(); myHandController.IClose(false); myHandController.isClose = false; myHandController.IPronation(false); TargetHand01.SetActive(true); TargetHand02.SetActive(false); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 3: myHandController.IExtension(); myHandController.IOpen(false); myHandController.isClose = true; myHandController.IPronation(false); TargetHand01.SetActive(false); TargetHand02.SetActive(true); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 4: myHandController.IFlexion(); myHandController.IOpen(false); myHandController.isClose = true; myHandController.IPronation(false); TargetHand01.SetActive(false); TargetHand02.SetActive(true); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 5: myHandController.IFlexion(); myHandController.IClose(false); myHandController.isClose = false; myHandController.ISupination(false); TargetHand01.SetActive(true); TargetHand02.SetActive(false); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 6: myHandController.IExtension(); myHandController.IClose(false); myHandController.isClose = false; myHandController.ISupination(false); TargetHand01.SetActive(true); TargetHand02.SetActive(false); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 7: myHandController.IExtension(); myHandController.IOpen(false); myHandController.isClose = true; myHandController.ISupination(false); TargetHand01.SetActive(false); TargetHand02.SetActive(true); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = $"Combination {i} : Please try to move the hand to the target state"; SendMessageToServer("205"); break; case 8: myHandController.IFlexion(); myHandController.IOpen(false); myHandController.isClose = true; myHandController.ISupination(false); TargetHand01.SetActive(false); TargetHand02.SetActive(true); yield return(new WaitForSeconds(2f)); myHandController.StartOneTesting(); IntroText.text = "Please try to move the hand to the original state"; SendMessageToServer("205"); break; case 9: IntroText.text = "The Testing Process is Over, Waitting for next process"; break; default: IntroText.text = "Wrong Combiantion Index"; break; } _isPreparing = false; }
// Update is called once per frame void Update() { if (!_connected) { return; } if (!_serverCommandNew) { return; } _serverCommandNew = false; switch (_serverCommand) { case 100: myHandController.IResetHand(); IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.NoMovement]; break; case 101: IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.Close]; myHandController.IClose(); break; case 102: IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.Open]; myHandController.IOpen(); break; case 103: IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.Supination]; myHandController.ISupination(); break; case 104: IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.Pronation]; myHandController.IPronation(); break; case 105: IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.Flexion]; myHandController.IFlexion(); break; case 106: IntroText.text = myHandController.GestureIntro[MyHandController.GestureState.Extension]; myHandController.IExtension(); break; case 1010: IntroText.text = "The Trainning Process is Over, Waitting for next process"; myHandController.IResetHand(); break; case 1011: StartTestScene(); break; default: break; } }