Пример #1
0
    void fingerEvent(string st)
    {
        switch (st)
        {
        case "index":
            IndexOn.Invoke();
            if (eventstatus2)
            {
                MiddleOff.Invoke();
            }

            if (eventstatus3)
            {
                RingOff.Invoke();
            }

            break;

        case "middle":
            MiddleOn.Invoke();
            if (eventstatus1)
            {
                IndexOff.Invoke();
            }
            if (eventstatus3)
            {
                RingOff.Invoke();
            }

            break;

        case "ring":
            if (eventstatus1)
            {
                IndexOff.Invoke();
            }

            if (eventstatus2)
            {
                MiddleOff.Invoke();
            }
            RingOn.Invoke();
            break;

        case "event1":
            IndexOff.Invoke();
            break;

        case "event2":
            MiddleOff.Invoke();
            break;

        case "event3":
            RingOff.Invoke();
            break;
        }
    }
Пример #2
0
    private void Update()
    {
        if (!indexActive && !middleActive && !ringAndPinkyActive && !thumbActive)
        {
            Debug.Log("AllFingerClosed");
            //   LostInventry.Invoke();

            IndexOff.Invoke();

            MiddleOff.Invoke();

            MiddleOff.Invoke();

            fingerEvent("eventend");
            eventstatus1 = false;
            eventstatus2 = false;
            eventstatus3 = false;
        }
        if (!indexActive && !middleActive && !ringAndPinkyActive && thumbActive)
        {
            IndexOff.Invoke();

            MiddleOff.Invoke();

            MiddleOff.Invoke();
            LostInventry.Invoke();
            eventstatus1 = false;
            eventstatus2 = false;
            eventstatus3 = false;
        }
        if (indexActive && !middleActive && !ringAndPinkyActive && thumbActive)
        {
            if (setFirst)
            {
                Debug.Log("1");
                setFirst     = !setFirst;
                eventstatus1 = true;
                fingerEvent("index");
            }
        }
        else
        {
            if (!setFirst)
            {
                setFirst = true;
                if (eventstatus1)
                {
                    eventstatus1 = false;
                    fingerEvent("event1");
                }
            }
        }


        if (indexActive && middleActive && !ringAndPinkyActive && thumbActive)
        {
            if (setSecond)
            {
                Debug.Log("2");
                setSecond    = !setSecond;
                eventstatus2 = true;
                fingerEvent("middle");
            }
        }
        else
        {
            if (!setSecond)
            {
                setSecond = true;
                if (eventstatus2)
                {
                    eventstatus2 = false;
                    fingerEvent("event2");
                }
            }
        }


        if (indexActive && middleActive && ringAndPinkyActive && thumbActive)
        {
            if (setThird)
            {
                Debug.Log("3");
                setThird     = !setThird;
                eventstatus3 = true;
                fingerEvent("ring");
            }
        }
        else
        {
            if (!setThird)
            {
                setThird = true;
                if (eventstatus3)
                {
                    eventstatus3 = false;
                    Debug.Log("LingOf");
                    fingerEvent("event3");
                }
            }
        }

        if (handlost)
        {
            HandLost.Invoke();
            eventstatus1 = false;
            eventstatus2 = false;
            eventstatus3 = false;
            setFirst     = true;
            setSecond    = true;
            setThird     = true;
        }

        if (thumbActive)
        {
            ThumbOn.Invoke();
        }
        else
        {
            ThumbOff.Invoke();
        }
    }