public SpellHandler.SpellType EndGesture() { //If the gesture was already ended if (lNextSample == -1 && rNextSample == -1) { return(SpellHandler.SpellType.NONE); } lNextSample = -1; rNextSample = -1; Gesture.GestureHand hands = currentGesture.GetCurHands(); //If there's only 1 node in one of the hands just delete the gesture and stop cause otherwise bad things happen during conversion if ((hands == Gesture.GestureHand.LEFT && currentGesture.NumNodes(Gesture.GestureHand.LEFT) < 2) || (hands == Gesture.GestureHand.RIGHT && currentGesture.NumNodes(Gesture.GestureHand.RIGHT) < 2) || (hands == Gesture.GestureHand.BOTH && (currentGesture.NumNodes(Gesture.GestureHand.LEFT) < 2 || currentGesture.NumNodes(Gesture.GestureHand.RIGHT) < 2))) { currentGesture = null; return(SpellHandler.SpellType.NONE); } currentGesture.ChangeNumNodes(samplesPerGesture); return(FindBestMatch(currentGesture)); }