Esempio n. 1
0
    public void OnDrag(PointerEventData eventData)
    {
        if (isOnObject)
        {
            points.Add(eventData.position);
            UpdateLine();
            if (canCheck)
            {
                canCheck = false;
                Recognizer.RecognitionResult result = recognizer.Recognize(points);

                StopAllCoroutines();

                if (result.score.score >= scoreToAccept)
                {
                    clearLineTimer = 0;
                    points.Clear();
                    PairGameManager.Instance.clearActivePiece();
                }
                else
                {
                }
            }
        }
        else
        {
            points.Clear();
            UpdateLine();
        }
    }
Esempio n. 2
0
    public void OnDrag(PointerEventData eventData)
    {
        points.Add(eventData.position);
        UpdateLine();
        if (canCheck)
        {
            canCheck = false;
            Recognizer.RecognitionResult result = recognizer.Recognize(points);

            StopAllCoroutines();
            ActiveAllDrawings();

            if (result.score.score >= scoreToAccept)
            {
                labelResult.text = Mathf.RoundToInt(result.score.score * 100) + "%";
                StartCoroutine(Blink(references[result.pattern]));
                clearLineTimer = 0;
                points.Clear();
            }
            else
            {
                labelResult.text = "?";
            }
        }
    }
Esempio n. 3
0
    public void OnDrag(PointerEventData eventData)
    {
        if (!allMotionsAllowed)
        {
            points.Add(eventData.position);
            pointTimes.Add(Time.time);
            if (maxPointsCount > 0 && points.Count > maxPointsCount)
            {
                points.RemoveRange(0, points.Count - maxPointsCount);
                pointTimes.RemoveRange(0, pointTimes.Count - maxPointsCount);
            }

            if (isOnCar && points.Count >= minPointsCount)
            {
                Recognizer.RecognitionResult result = recognizer.Recognize(points);

                if (result.score.score >= scoreToAccept)
                {
                    dragTypeResetTime = 0;
                    switch (result.pattern.id)
                    {
                    case "horizontal":
                        currentDragType = DragTypeAraba.Horizontal;
                        break;

                    case "vertical":
                        currentDragType = DragTypeAraba.Vertical;
                        break;

                    case "circular":
                        currentDragType = DragTypeAraba.Circular;
                        break;

                    default:
                        currentDragType = DragTypeAraba.AllMotions;
                        break;
                    }
                    //lastRightDragTypeTime = Time.time;
                }
                else
                {
                    //currentDragType = DragTypeAraba.AllMotions;
                }
                //Debug.Log("score: " + result.score.score + " - " + currentDragType.ToString() + " - points: " + points.Count);
            }
            else
            {
                //Debug.Log("score: none - " + currentDragType.ToString() + " - points: " + points.Count);

                //currentDragType = DragTypeAraba.AllMotions;
            }
        }
        //else
        //{
        //    lastRightDragTypeTime = Time.time;
        //}
    }