Пример #1
0
    // adds a gesture to the list of detected gestures for the specified user
    public void DetectGesture(uint UserId, KinectWrapper.Gestures gesture)
    {
        int index = GetGestureIndex(UserId, gesture);
        if(index >= 0)
            DeleteGesture(UserId, gesture);

        KinectWrapper.GestureData gestureData = new KinectWrapper.GestureData();

        gestureData.userId = UserId;
        gestureData.gesture = gesture;
        gestureData.state = 0;
        gestureData.joint = 0;
        gestureData.progress = 0f;
        gestureData.complete = false;
        gestureData.cancelled = false;

        gestureData.checkForGestures = new List<KinectWrapper.Gestures>();
        switch(gesture)
        {
            case KinectWrapper.Gestures.ZoomIn:
                gestureData.checkForGestures.Add(KinectWrapper.Gestures.ZoomOut);
                gestureData.checkForGestures.Add(KinectWrapper.Gestures.Wheel);
                break;

            case KinectWrapper.Gestures.ZoomOut:
                gestureData.checkForGestures.Add(KinectWrapper.Gestures.ZoomIn);
                gestureData.checkForGestures.Add(KinectWrapper.Gestures.Wheel);
                break;

            case KinectWrapper.Gestures.Wheel:
                gestureData.checkForGestures.Add(KinectWrapper.Gestures.ZoomIn);
                gestureData.checkForGestures.Add(KinectWrapper.Gestures.ZoomOut);
                break;
        }

        if(UserId == Player1ID)
            player1Gestures.Add(gestureData);
        else if(UserId == Player2ID)
            player2Gestures.Add(gestureData);
    }
Пример #2
0
    public void DetectGesture(uint UserId, KinectWrapper.Gestures gesture)
    {
        int index = GetGestureIndex(UserId, gesture);
        if(index >= 0)
            DeleteGesture(UserId, gesture);

        KinectWrapper.GestureData gestureData = new KinectWrapper.GestureData();

        gestureData.userId = UserId;
        gestureData.gesture = gesture;
        gestureData.state = 0;
        gestureData.joint = 0;
        gestureData.progress = 0f;
        gestureData.complete = false;

        if(UserId == Player1ID)
            player1Gestures.Add(gestureData);
        else if(UserId == Player2ID)
            player2Gestures.Add(gestureData);
    }