Пример #1
0
        public void SetFingerGroupCurl(FingerGroup fingerGroupID, float curlValue)
        {
            switch (fingerGroupID)
            {
            case FingerGroup.AllButIndex:
                SetFingerCurl(Finger.Thumb, curlValue);
                SetFingerCurl(Finger.Middle, curlValue);
                SetFingerCurl(Finger.Ring, curlValue);
                SetFingerCurl(Finger.Little, curlValue);
                break;

            case FingerGroup.FingersButIndex:
                SetFingerCurl(Finger.Middle, curlValue);
                SetFingerCurl(Finger.Ring, curlValue);
                SetFingerCurl(Finger.Little, curlValue);
                break;

            case FingerGroup.AllFingers:
                SetFingerCurl(Finger.Index, curlValue);
                SetFingerCurl(Finger.Middle, curlValue);
                SetFingerCurl(Finger.Ring, curlValue);
                SetFingerCurl(Finger.Little, curlValue);
                break;
            }
        }
Пример #2
0
    private void CheckFingerGroup(Touch touch)
    {
        bool flag = false;

        for (int i = 0; i < this.fingerGroup.Count; i++)
        {
            FingerGroup fingerGroup = this.fingerGroup[i];
            if (!(Time.realtimeSinceStartup - fingerGroup.triggerTime < shortTapTime / 2f))
            {
                continue;
            }
            bool flag2 = true;
            for (int j = 0; j < fingerGroup.indexes.Count; j++)
            {
                int iD = fingerGroup.indexes[j];
                if (Vector2.Distance(IT_Gesture.GetTouch(iD).position, touch.position) > maxFingerGroupDist * IT_Gesture.GetDPIFactor())
                {
                    flag2 = false;
                }
            }
            if (flag2)
            {
                fingerGroup.indexes.Add(touch.fingerId);
                fingerGroup.positions.Add(touch.position);
                flag = true;
                break;
            }
        }
        if (!flag)
        {
            this.fingerGroup.Add(new FingerGroup(Time.realtimeSinceStartup, touch.fingerId, touch.position));
            StartCoroutine(this.fingerGroup[this.fingerGroup.Count - 1].Routine(this));
        }
    }
Пример #3
0
    void CheckFingerGroup(Touch touch)
    {
        //Debug.Log("Checking "+Time.realtimeSinceStartup);
        bool match = false;

        //foreach(FingerGroup group in fingerGroup){
        for (int i = 0; i < fingerGroup.Count; i++)
        {
            FingerGroup group = fingerGroup[i];
            if (Time.realtimeSinceStartup - group.triggerTime < shortTapTime / 2)
            {
                bool  inRange = true;
                float dist    = 0;
                //foreach(int index in group.indexes){
                for (int j = 0; j < group.indexes.Count; j++)
                {
                    int index = group.indexes[j];
                    dist = Vector2.Distance(IT_Gesture.GetTouch(index).position, touch.position);
                    if (Vector2.Distance(IT_Gesture.GetTouch(index).position, touch.position) > maxFingerGroupDist * IT_Gesture.GetDPIFactor())
                    {
                        inRange = false;
                    }
                }
                if (inRange)
                {
                    group.indexes.Add(touch.fingerId);
                    group.positions.Add(touch.position);
                    match = true;
                    break;
                }
            }
        }

        if (!match)
        {
            fingerGroup.Add(new FingerGroup(Time.realtimeSinceStartup, touch.fingerId, touch.position));
            StartCoroutine(fingerGroup[fingerGroup.Count - 1].Routine(this));
        }
    }