/// <summary>
    /// Recognize drawn gesture
    /// </summary>
    void Recognize()
    {
        if (multiStrokePoints.Count > minimumPointsToRecognize) {
            multiStroke = new MultiStroke(multiStrokePoints.ToArray());

            result = multiStroke.Recognize(ml);
            isRecognized = true;

            SetMessage("MultiStroke is recognized as <color=#ff0000>'" + result.Name + "'</color> with a score of " + result.Score);
        }
    }
    // Track user input and fire OnRecognition event when necessary.
    void Update()
    {
        // Track user input if GestureRecognition is enabled.
        if (isEnabled) {

            // If it is a touch device, get the touch position
            // if it is not, get the mouse position
            if (Utility.IsTouchDevice()) {
                if (Input.touchCount > 0) {
                    virtualKeyPosition = new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y);
                }
            } else {
                if (Input.GetMouseButton(0)) {
                    virtualKeyPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y);
                }
            }

            // It is not necessary to track the touch from this point on,
            // because it is already registered, and GetMouseButton event
            // also fires on touch devices
            if (Input.GetMouseButtonDown(0)) {
                point = Vector2.zero;
                lastPoint = Vector2.zero;
                AddStroke();
            }

            // It is not necessary to track the touch from this point on,
            // because it is already registered, and GetMouseButton event
            // also fires on touch devices
            if (Input.GetMouseButton(0)) {

                point = new Vector2(virtualKeyPosition.x, -virtualKeyPosition.y);

                // Register this point only if the point list is empty or current point
                // is far enough than the last point. This ensures that the multi stroke looks
                // good on the screen. Moreover, it is good to not overpopulate the screen
                // with so much points.
                if (Vector2.Distance(point, lastPoint) > distanceBetweenPoints) {
                    multiStrokePoints.Add(new MultiStrokePoint(point.x, point.y, lastStrokeID));
                    lastPoint = point;

                    currentStrokeRenderer.SetVertexCount(++vertexCount);
                    currentStrokeRenderer.SetPosition(vertexCount - 1, Utility.WorldCoordinateForGesturePoint(virtualKeyPosition));
                }

            }

            // Capture the multi stroke, recognize it, fire the recognition event,
            // and clear the multi stroke from the screen.
            if (Input.GetMouseButtonDown(1)) {

                if (multiStrokePoints.Count > minimumPointsToRecognize) {
                    multiStroke = new MultiStroke(multiStrokePoints.ToArray());
                    result = multiStroke.Recognize(ml);

                    if (OnRecognition != null) {
                        OnRecognition(result);
                    }
                }

                ClearGesture();
            }
        }
    }
    // Track user input and fire OnRecognition event when necessary.
    void Update()
    {
        // Track user input if GestureRecognition is enabled.
        if (isEnabled) {

            // If it is a touch device, get the touch position
            // if it is not, get the mouse position
            if (Utility.IsTouchDevice()) {
                if (Input.touchCount > 0) {
                    virtualKeyPosition = new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y);
                }
            } else {
                if (Input.GetMouseButton(0)) {
                    virtualKeyPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y);
                }
            }

            // It is not necessary to track the touch from this point on,
            // because it is already registered, and GetMouseButton event
            // also fires on touch devices
            if (Input.GetMouseButtonDown(0)) {
                point = Vector2.zero;
                lastPoint = Vector2.zero;
                AddStroke();
            }

            // It is not necessary to track the touch from this point on,
            // because it is already registered, and GetMouseButton event
            // also fires on touch devices
            if (Input.GetMouseButton(0)) {

                switch (gestureLimitType) {

                    case GestureLimitType.None:
                        RegisterPoint();
                        break;

                    case GestureLimitType.RectBoundsIgnore:
                        if (RectTransformUtility.RectangleContainsScreenPoint(gestureLimitRectBounds, virtualKeyPosition, null)) {
                            RegisterPoint();
                        }
                        break;

                    case GestureLimitType.RectBoundsClamp:
                        virtualKeyPosition = Utility.ClampPointToRect(virtualKeyPosition, gestureLimitRect);
                        RegisterPoint();
                        break;
                }

            }

            // Capture the multi stroke, recognize it, fire the recognition event,
            // and clear the multi stroke from the screen.
            if (Input.GetMouseButtonDown(1)) {

                if (multiStrokePoints.Count > minimumPointsToRecognize) {
                    multiStroke = new MultiStroke(multiStrokePoints.ToArray());
                    result = multiStroke.Recognize(ml);

                    if (OnRecognition != null) {
                        OnRecognition(result);
                    }
                }

                ClearGesture();
            }
        }
    }
    void Recognize()
    {
        if (multiStrokePoints.Count > minimumPointsToRecognize) {
            multiStroke = new MultiStroke(multiStrokePoints.ToArray());

            result = multiStroke.Recognize(ml);
            isRecognized = true;

            message = result.Name + "; " + result.Score;
        }
    }