LightBuzz.Vitruvius.Gesture.Update C# (CSharp) Method

Update() public method

Updates the current gesture.
public Update ( Body body ) : void
body Body The body data.
return void
        public void Update(Body body)
        {
            if (_paused)
            {
                if (_frameCount == _pausedFrameCount)
                {
                    _paused = false;
                }

                _frameCount++;
            }

            GesturePartResult result = _segments[_currentSegment].Update(body);

            if (result == GesturePartResult.Succeeded)
            {
                if (_currentSegment + 1 < _segments.Length)
                {
                    _currentSegment++;
                    _frameCount = 0;
                    _pausedFrameCount = MAX_PAUSE_COUNT;
                    _paused = true;
                }
                else
                {
                    if (GestureRecognized != null)
                    {
                        GestureRecognized(this, new GestureEventArgs(_name, body.TrackingId));
                        Reset();
                    }
                }
            }
            else if (result == GesturePartResult.Failed || _frameCount == WINDOW_SIZE)
            {
                Reset();
            }
            else
            {
                _frameCount++;
                _pausedFrameCount = MAX_PAUSE_COUNT / 2;
                _paused = true;
            }
        }