コード例 #1
0
    public void CheckGesture()
    {
        _lastFrame = _leap_controller.Frame(0);
        tFrame     = _leap_controller.Frame(5);
        Hands      = _lastFrame.Hands;

        foreach (Hand hand in Hands)
        {
            tempHand = hand;
            Fingers  = hand.Fingers;
            if (WhichSide.IsEnableGestureHand(this) && WhichSide.IsEnableGestureHand(this) && WhichSide.capturedSide(hand, _useArea, _mountType))
            {
                this._isChecked = GestureCondition();
                if (this._isChecked)
                {
                    break;
                }
            }
        }



        if (_isChecked)
        {
            DoAction();
        }
    }
コード例 #2
0
    public virtual void CheckGesture()
    {
        this._lastFrame = this._leap_controller.Frame(0);
        this.Hands      = this._lastFrame.Hands;
        this._gestures  = this._lastFrame.Gestures();

        foreach (Hand hand in Hands)
        {
            tempHand = hand;
            _fingers = hand.Fingers;

            if (WhichSide.IsEnableGestureHand(this))
            {
                this._fingers = hand.Fingers;

                foreach (Gesture gesture in _gestures)
                {
                    if ((gesture.Type == Gesture.GestureType.TYPE_KEY_TAP) && WhichSide.capturedSide(hand, _useArea, _mountType))
                    {
                        _keytab_gesture = new KeyTapGesture(gesture);
                        this.GetDirection();
                        this.GetPointable();
                        this.GestureInvokePosition();

                        this._isChecked = true;
                        break;
                    }
                }
            }

            if (this._isChecked)
            {
                break;
            }
        }

        if (this._isChecked)
        {
            DoAction();
        }
    }
コード例 #3
0
    public virtual void CheckGesture()
    {
        _lastFrame = _leap_controller.Frame();
        Hands      = _lastFrame.Hands;

        foreach (Hand hand in Hands)
        {
            tempHand = hand;
            if (WhichSide.IsEnableGestureHand(this) && WhichSide.capturedSide(hand, _useArea, _mountType) && IsCorrectHandDirection(hand))
            {
                this._isChecked = true;
                break;
            }
        }



        if (this._isChecked)
        {
            DoAction();
        }
    }
コード例 #4
0
 public bool IsEnableGestureHand()
 {
     return(WhichSide.IsEnableGestureHand(this));
 }
コード例 #5
0
    //Virtual method for gesture checking.
    public virtual void CheckGesture()
    {
        _lastFrame = _leap_controller.Frame(0);
        Hands      = _lastFrame.Hands;
        _gestures  = _lastFrame.Gestures();

        foreach (Hand hand in Hands)
        {
            tempHand = hand;
            _fingers = hand.Fingers;
            if (WhichSide.IsEnableGestureHand(this))
            {
                foreach (Gesture gesture in _gestures)
                {
                    _fingers = hand.Fingers;
                    if (gesture.Type == Gesture.GestureType.TYPE_CIRCLE)
                    {
                        _circle_gesture = new CircleGesture(gesture);
                        if (!_isPlaying && (gesture.State == Gesture.GestureState.STATE_START) && WhichSide.capturedSide(hand, _useArea, _mountType))
                        {
                            _isPlaying          = !_isPlaying;
                            this._startProgress = _circle_gesture.Progress;
                        }

                        if (_isPlaying && gesture.State == Gesture.GestureState.STATE_STOP)
                        {
                            int direc = PropertyGetter.IsClockWise(this);
                            this._endProgress = _circle_gesture.Progress;
                            if (this._endProgress >= this.MinProgress && direc == _useDirection)
                            {
                                this._isChecked = true;
                                this._isPlaying = !this._isPlaying;
                            }
                            this._state = gesture.State;

                            break;
                        }
                        this._state = gesture.State;
                    }
                }

                if (_isPlaying && _state == Gesture.GestureState.STATE_UPDATE)
                {
                    int direc = this.IsClockWise();
                    this._endProgress = _circle_gesture.Progress;
                    if (this._endProgress >= this.MinProgress && direc == _useDirection)
                    {
                        this._isChecked = true;
                        this._isPlaying = !this._isPlaying;
                    }
                }
            }
            if (this._isChecked)
            {
                break;
            }
        }



        if (_isChecked)
        {
            DoAction();
        }
    }
コード例 #6
0
    //-----------------------------------------------------
    // Function for check gesture occur every frame.
    public virtual void CheckGesture()
    {
        _lastFrame = _leap_controller.Frame();
        Hands      = _lastFrame.Hands;
        _gestures  = _lastFrame.Gestures();


        foreach (Hand hand in Hands)
        {
            tempHand = hand;
            _fingers = hand.Fingers;

            if (WhichSide.IsEnableGestureHand(this))
            {
                foreach (Gesture gesture in _gestures)
                {
                    if (gesture.Type == Gesture.GestureType.TYPE_SWIPE)
                    {
                        _swipe_gestrue = new SwipeGesture(gesture);

                        if (!_isPlaying && gesture.State == Gesture.GestureState.STATE_START && WhichSide.capturedSide(hand, _useArea, this._mountType))
                        {
                            _isPlaying  = true;
                            _startPoint = hand.PalmPosition;
                        }

                        if (_isPlaying && gesture.State == Gesture.GestureState.STATE_STOP)
                        {
                            _endPoint = hand.PalmPosition;
                            switch (UseAxis)
                            {
                            case 'x':
                                if (((_endPoint.x - _startPoint.x) * _useDirection) > Sensitivity)
                                {
                                    this._isChecked = true;
                                    _isPlaying      = !_isPlaying;
                                    break;
                                }
                                _state = gesture.State;
                                break;

                            case 'y':
                                if (((_endPoint.y - _startPoint.y) * _useDirection) > Sensitivity)
                                {
                                    this._isChecked = true;
                                    _isPlaying      = !_isPlaying;
                                    break;
                                }
                                _state = gesture.State;
                                break;

                            case 'z':
                                if (_startPoint.y < this._maxY && _endPoint.y < this._maxY &&
                                    ((_endPoint.z - _startPoint.z) * _useDirection) > Sensitivity)
                                {
                                    this._isChecked = true;
                                    _isPlaying      = !_isPlaying;
                                    _state          = gesture.State;
                                    break;
                                }
                                _state = gesture.State;
                                break;

                            default:
                                break;
                            }
                        }

                        if (!this._isPlaying || this._isChecked)
                        {
                            break;
                        }

                        _state = gesture.State;
                    }
                }

                if (_isPlaying && _state == Gesture.GestureState.STATE_UPDATE && WhichSide.capturedSide(hand, _useArea, this.MountType))
                {
                    _endPoint = hand.PalmPosition;
                    switch (UseAxis)
                    {
                    case 'x':
                        if (((_endPoint.x - _startPoint.x) * _useDirection) > Sensitivity)
                        {
                            this._isChecked = true;
                            _isPlaying      = !_isPlaying;
                            break;
                        }
                        break;

                    case 'y':
                        if (((_endPoint.y - _startPoint.y) * _useDirection) > Sensitivity)
                        {
                            this._isChecked = true;
                            _isPlaying      = !_isPlaying;
                            break;
                        }
                        break;

                    case 'z':
                        if (_startPoint.y < this._maxY && _endPoint.y < this._maxY &&
                            ((_endPoint.z - _startPoint.z) * _useDirection) > Sensitivity)
                        {
                            this._isChecked = true;
                            _isPlaying      = !_isPlaying;
                            break;
                        }
                        else
                        {
                            _isPlaying = !_isPlaying;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }


        // --------------------
        // If Gesture is captured, call the handler function 'DoAction()'
        if (_isChecked)
        {
            DoAction();
        }
        //---------------------
    }