示例#1
0
    /// <summary>
    /// Recognize drawn gesture
    /// </summary>
    public void Recognize()
    {
        if (multiStrokePoints.Count > minimumPointsToRecognize)
        {
            multiStroke = new MultiStroke(multiStrokePoints.ToArray());

            result       = multiStroke.Recognize(ml);
            isRecognized = true;
            Debug.Log(result.Score);

            if (result.Name == "new_elka")
            {
                if (result.Score < 1.4f && result.Score > 0.4f)
                {
                    handBranch.SetActive(false);
                    handBranch2.SetActive(true);
                    SetMessage("MultiStroke is recognized as <color=#ff0000>'" + result.Name + "'</color> with a score of " + result.Score);
                    ControllerPanel4 controllerPanel4 = FindObjectOfType <ControllerPanel4>();
                    controllerPanel4.RecognizeFirstPicture();
                    gameObject.SetActive(false);
                    ClearMultiStroke();
                }
                else
                {
                    ClearMultiStroke();
                    handBranch.SetActive(true);
                    handBranch2.SetActive(false);
                    SetMessage("Не удалось распознать");
                }
            }
            else if (result.Name == "new_belka")
            {
                if (result.Score < 1.4f && result.Score > 0.5f)
                {
                    handBranch.SetActive(false);
                    handBranch2.SetActive(true);
                    SetMessage("MultiStroke is recognized as <color=#ff0000>'" + result.Name + "'</color> with a score of " + result.Score);
                    ControllerPanel4 controllerPanel4 = FindObjectOfType <ControllerPanel4>();
                    controllerPanel4.RecognizeSecondPicture();
                    gameObject.SetActive(false);
                    ClearMultiStroke();
                    SetMessage("MultiStroke is recognized as <color=#ff0000>'" + result.Name + "'</color> with a score of " + result.Score);
                }
                else
                {
                    ClearMultiStroke();
                    handBranch.SetActive(true);
                    handBranch2.SetActive(false);
                    SetMessage("Не удалось распознать");
                }
            }
            else
            {
                SetMessage("Не удалось распознать");
            }
            //SetMessage("MultiStroke is recognized as <color=#ff0000>'" + result.Name + "'</color> with a score of " + result.Score);
        }
    }
示例#2
0
 private void Awake()
 {
     _wordAppearanceController = FindObjectOfType <WordAppearanceController>();
     _controllerPanel4         = FindObjectOfType <ControllerPanel4>();
 }