/// <summary>
        /// Update Text Gesture
        /// Updates the given text element to describe the given gesture.
        /// </summary>
        /// <param name="gesture">The gesture's type we want to display through the UI.</param>
        /// <param name="uiText">The ui text element using to display the gesture's type.</param>
        private void UpdateTextGesture(GesturesForDemo gesture, Text uiText)
        {
            if (uiText != null)
            {
                switch (gesture)
                {
                case GesturesForDemo.RightSwipe:
                    uiText.text = "Right Hand Right Swipe";
                    break;

                case GesturesForDemo.LeftSwipe:
                    uiText.text = "Right Hand Left Swipe";
                    break;

                case GesturesForDemo.SwipeUp:
                    uiText.text = "Swipe Up";
                    break;

                case GesturesForDemo.Punch:
                    uiText.text = "Punch";
                    break;

                case GesturesForDemo.Run:
                    uiText.text = "Run";
                    break;

                case GesturesForDemo.PraiseTheSun:
                    uiText.text = "Praise the Sun! \\[T]/";
                    break;

                case GesturesForDemo.PraiseToMenu:
                    uiText.text = "\\[T]/ To Menu!";
                    break;

                case GesturesForDemo.NONE:
                    uiText.text = "None";
                    break;

                default:
                    uiText.text = "Unknown Gesture";
                    break;
                }
                UpdateUIColor();
            }
        }
Пример #2
0
        /// <summary>
        /// UpdateRecognizedGestureText
        /// Updates the text of the UI element registered as holder of
        /// the recognized gesture's name.
        /// </summary>
        /// <param name="gesture">The gesture's type we've recognized.</param>
        public void UpdateRecognizedGesture(GesturesForDemo gesture)
        {
            if (recognizedGestureText != null)
            {
                switch (gesture)
                {
                case GesturesForDemo.RightSwipe:
                    recognizedGestureText.text = "Right Hand Right Swipe";
                    break;

                case GesturesForDemo.LeftSwipe:
                    recognizedGestureText.text = "Right Hand Left Swipe";
                    break;

                case GesturesForDemo.SwipeUp:
                    recognizedGestureText.text = "Swipe Up";
                    break;

                case GesturesForDemo.Punch:
                    recognizedGestureText.text = "Punch";
                    break;

                case GesturesForDemo.Run:
                    recognizedGestureText.text = "Run";
                    break;

                case GesturesForDemo.PraiseTheSun:
                    recognizedGestureText.text = "Praise the Sun! \\[T]/";
                    break;

                case GesturesForDemo.PraiseToMenu:
                    recognizedGestureText.text = "\\[T]/ for Menu";
                    break;

                case GesturesForDemo.NONE:
                    recognizedGestureText.text = "None";
                    break;

                default:
                    recognizedGestureText.text = "Unknown Gesture";
                    break;
                }
            }
        }
        /// <summary>
        /// Start
        /// Unity Standard Method. Use to initialize the gameloop components.
        /// </summary>
        void Start()
        {
            recognizer = GameObject.FindObjectOfType <KinectOverlay.RecognizeGesture>();


            if (recognizer != null)
            {
                processingGesture     = false;
                lastRecognizedGesture = GesturesForDemo.NONE;
                if (recognitionUI != null)
                {
                    recognitionUI.UpdateRecognizedGesture(GesturesForDemo.NONE);
                }
            }
            else
            {
                Debug.LogError("Error, no RecognizeGesture component can be found. Recognition can't be done without it.");
            }
        }
 /// <summary>
 /// UpdateRecognizedGestureText
 /// Updates the text of the UI element registered as holder of
 /// the recognized gesture's name.
 /// </summary>
 /// <param name="gesture">The gesture's type we've recognized.</param>
 public void UpdateRecognizedGestureText(GesturesForDemo gesture)
 {
     recognizedGesture = gesture;
     UpdateTextGesture(gesture, recognizedGestureText);
 }
 /// <summary>
 /// UpdateExpectedGestureText
 /// Updates the text of the UI element registered as holder of
 /// the expected gesture's name.
 /// </summary>
 /// <param name="gesture">The gesture's type we're expecting.</param>
 public void UpdateExpectedGestureText(GesturesForDemo gesture)
 {
     expectedGesture = gesture;
     UpdateTextGesture(gesture, expectedGestureText);
 }