Esempio n. 1
0
        public void onStrokeComplete()
        {
            DrawLine       script = drawLineObj.GetComponent <DrawLine>();
            List <Vector3> points = script.getPointsList();

            this.corners = ShortStraw.getCornerPoints(points);
            markCorners(corners);
            charCorners[curStroke] = corners; // FIXME
            Debug.Log("Stroke Complete!");
        }
Esempio n. 2
0
        private void onResetCharacter()
        {
            corners     = new List <Vector3>();
            charCorners = new List <Vector3> [charData.numStrokes];
            curStroke   = 0;
            setSprite(charData.spriteNames[curStroke]);
            clearMarks();
            DrawLine script = drawLineObj.GetComponent <DrawLine>();

            script.clearLine();
        }
Esempio n. 3
0
        public void onStrokeComplete()
        {
            DrawLine       script = drawLineObj.GetComponent <DrawLine>();
            List <Vector3> points = script.getPointsList();

            this.corners = ShortStraw.getCornerPoints(points);
            script.clearLine();

            if (showMarks)
            {
                markCorners(corners);
            }

            charCorners[curStroke] = corners; // FIXME
            Debug.Log("Stroke Complete!");
            //foreach (Vector3 corner in corners) {
            //    Debug.Log(string.Format("    {0}, {1}, {2}", corner.x, corner.y, corner.z));
            //}

            Recognizer  recognizer = new Recognizer();
            StrokeScore score      = recognizer.getResults(corners, charData.strokes[curStroke]);

            Debug.Log(string.Format("    *** {0} *** angle: {1}, corners: {2}, dist: {3}",
                                    score.Pass ? "Pass" : "Fail", score.Angle, score.Corners, score.Distance));

            // show sprite stroke for the just completed stroke
            if (score.Pass)
            {
                setStrokeSprite(charData.spriteNames[curStroke]);
                curStroke++;
            }

            if (curStroke >= charData.numStrokes)
            {
                // the character is complete, back out of scene
                Debug.Log("Character complete!");
                curStroke--;
            }
            else
            {
                StartCoroutine(displayStrokeHint(curStroke));
            }
        }