Exemplo n.º 1
0
    public void RecognizerJudge(List <Vector3> vecList)
    {
        // Shift all points to positive quadrant
        if (makePositive)
        {
            vecList = PositiveQ(vecList);
        }

        ps = ClassifierScript.ClassifyScore(vecList);

        if (ps == null)
        {
            if (showDebugMsg)
            {
                Debug.Log("Recognizer does not detect");
            }
            CheckMonsters2(DrawingManager.LineType.nothing.ToString());
        }
        else
        {
            if (showDebugMsg)
            {
                Debug.Log("Recognizer detected: " + ps.templateName);
            }
            CheckMonsters2(ps.templateName);
        }
    }
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            isValidStart = false;

            RaycastHit2D[] raycastHit2D = null;
            raycastHit2D = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
            foreach (RaycastHit2D ray2D in raycastHit2D)
            {
                if (ray2D == startArea)
                {
                    isValidStart = true;
                    break;
                }
            }

            if (isValidStart)
            {
                ClearScreen();
            }
        }

        if (Input.GetMouseButton(0) && isValidStart)
        {
            Vector3 _point = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            _point.z = 0f;

            gesturePoints.Add(_point);

            gestureRenderer.positionCount = gesturePoints.Count;
            gestureRenderer.SetPosition(gesturePoints.Count - 1, _point);
        }

        if (Input.GetMouseButtonUp(0))
        {
            PassStuff ps = ClassifierScript.ClassifyScore(gesturePoints);
            if (ps == null)
            {
                string msg = "Does not detect anything";
                Debug.Log(msg);
                statusText.text = msg;
            }
            else
            {
                string msg = "Detected: " + ps.templateName;
                Debug.Log(msg);
                statusText.text = msg;
            }
        }
    }
Exemplo n.º 3
0
    public void TryRecognize()
    {
        PassStuff ps = ClassifierScript.ClassifyScore(gesturePoints);

        if (ps == null)
        {
            string msg = "Does not detect anything";
            Debug.Log(msg);
            statusText.text = msg;
        }
        else
        {
            string msg = "Detected: " + ps.templateName;
            Debug.Log(msg);
            statusText.text = msg;
        }
    }