void NextMode() { if (null != uiFeedback) { StopCoroutine(uiFeedback); } AirSigManager.Mode prevMode = availableMode[currentModeIndex]; // Cycle through available gesture mode currentModeIndex++; if (currentModeIndex >= availableMode.Length) { currentModeIndex = 0; } airsigManager.SetMode(availableMode [currentModeIndex]); // Before actually change mode, set collected gesture as custom gesture if previous mode is AddPlayerGesture if (AirSigManager.Mode.AddPlayerGesture == prevMode) { airsigManager.SetPlayerGesture(new List <int> { PLAYER_GESTURE_ONE, PLAYER_GESTURE_TWO }, true); } else if (AirSigManager.Mode.SmartTrainDeveloperDefined == prevMode) { StartCoroutine(airsigManager.UpdateDeveloperDefinedGestureStat(true)); } // Update the display text textMode.text = string.Format("Mode: {0}", availableMode [currentModeIndex].ToString()); textResult.text = defaultResultText = DEFAULT_INSTRUCTION_TEXT; textResult.alignment = TextAnchor.UpperCenter; instruction.SetActive(false); ToggleGestureImage(""); if (AirSigManager.Mode.DeveloperDefined == availableMode[currentModeIndex]) { airsigManager.SetDeveloperDefinedTarget(new List <string> { "HEART", "C", "DOWN" }); airsigManager.SetClassifier("SampleGestureProfile", ""); } else if (AirSigManager.Mode.TrainPlayerSignature == availableMode [currentModeIndex] || AirSigManager.Mode.IdentifyPlayerSignature == availableMode [currentModeIndex]) { // Set target index to a pre-defined gesture index. The same index must be used for both train and identify airsigManager.SetTarget(new List <int> { PLAYER_SIGNATURE_INDEX }); } else if (AirSigManager.Mode.SmartTrainDeveloperDefined == availableMode[currentModeIndex]) { textResult.text = defaultResultText = "Please write 'HEART' gesture 5 times\nPress trigger to start\nRelease trigger when finish"; smartTrainCount = 0; airsigManager.SetClassifier("SampleGestureProfile", ""); airsigManager.SetDeveloperDefinedTarget(new List <string> { "HEART" }); ResetSmartTrainDeveloperDefinedStep(); } else if (AirSigManager.Mode.SmartIdentifyDeveloperDefined == availableMode[currentModeIndex]) { textResult.text = defaultResultText = "Try write 'Heart', 'C' and 'Down' gesture"; airsigManager.SetClassifier("SampleGestureProfile", ""); airsigManager.SetDeveloperDefinedTarget(new List <string> { "HEART", "C", "DOWN" }); } else if (AirSigManager.Mode.AddPlayerGesture == availableMode [currentModeIndex]) { // Set target index to one of pre-define gesture index The same index must be used for both add and identify. // Notice that adding custom gesture only adds to the engine's cache and must call SetCustomGesture with index // in order to train this gesture before it can be used to identify. textResult.text = defaultResultText = "Think of a gesture\nWrite it 5 times~\n<color=#FF00FF>GESTURE #1</color>"; airsigManager.SetTarget(new List <int> { PLAYER_GESTURE_ONE }); ResetPlayerGestureStep(); } else if (AirSigManager.Mode.IdentifyPlayerGesture == availableMode[currentModeIndex]) { textResult.text = defaultResultText = "Write gestures you just trained\nin AddPlayerGesture"; airsigManager.SetTarget(new List <int> { PLAYER_GESTURE_ONE, PLAYER_GESTURE_TWO }); } else if (AirSigManager.Mode.None == availableMode[currentModeIndex]) { setModeNone(); } }