/// <summary> /// Resets all gesture detectors based on the size of the player. /// </summary> private void SetGesturesToPlayer() { this.gestureDetectors = new Collection <GestureDetector>(); HorizontalSwipeGestureDetector swipeGestureDetector = new HorizontalSwipeGestureDetector(this.activeHand, 50, 1200, this.PlayerBodySize * 0.95f); this.gestureDetectors.Add(swipeGestureDetector); PushGestureDetector pushGestureDetector = new PushGestureDetector(this.activeHand, 30, 1000, this.PlayerBodySize * 0.45f); this.gestureDetectors.Add(pushGestureDetector); VerticalSwipeGestureDetector rightLegSwipeGestureDetector = new VerticalSwipeGestureDetector(JointType.FootRight, 60, 10, 0.053f * this.PlayerBodySize, 0.3f, 200, 2000, true, true); this.gestureDetectors.Add(rightLegSwipeGestureDetector); VerticalSwipeGestureDetector leftLegSwipeGestureDetector = new VerticalSwipeGestureDetector(JointType.FootLeft, 60, 10, 0.053f * this.PlayerBodySize, 0.3f, 200, 2000, true, true); this.gestureDetectors.Add(leftLegSwipeGestureDetector); VerticalSwipeGestureDetector headSwipeGestureDetector = new VerticalSwipeGestureDetector(JointType.Head, 45, 400, 0.67f * this.PlayerBodySize, 0.4f, 400, 1800); this.gestureDetectors.Add(headSwipeGestureDetector); }
/// <summary> /// Initializes a new instance of the <see cref="GestureManager"/> class. /// </summary> /// <param name="primaryHand">The hand to primarily track.</param> public GestureManager(JointType primaryHand = JointType.HandRight) { this.handSwitchTimer = 0.0f; this.PlayerBodySize = 0.0f; this.jumpThreshold = 0.1f; this.standardSpineY = 0.0f; this.runTimeLimit = 1.5; this.lastLegLiftCounter = 0.0f; this.acceptLeftLegLift = true; this.acceptRightLegLift = true; this.activeHand = primaryHand; if (this.activeHand == JointType.HandRight) { this.activeShoulder = JointType.ShoulderRight; } else { this.activeHand = JointType.ShoulderLeft; } this.detectedGestures = new Queue <GestureType>(); this.gestureDetectors = new Collection <GestureDetector>(); this.skeletonJoints = null; HorizontalSwipeGestureDetector swipeGestureDetector = new HorizontalSwipeGestureDetector(this.activeHand, 50, 1200); this.gestureDetectors.Add(swipeGestureDetector); PushGestureDetector pushGestureDetector = new PushGestureDetector(this.activeHand, 30); this.gestureDetectors.Add(pushGestureDetector); VerticalSwipeGestureDetector rightLegSwipeGestureDetector = new VerticalSwipeGestureDetector(JointType.FootRight, 60, 10, 0.035f, 0.3f, 200, 2000, true, true); this.gestureDetectors.Add(rightLegSwipeGestureDetector); VerticalSwipeGestureDetector leftLegSwipeGestureDetector = new VerticalSwipeGestureDetector(JointType.FootLeft, 60, 10, 0.035f, 0.3f, 200, 2000, true, true); this.gestureDetectors.Add(leftLegSwipeGestureDetector); VerticalSwipeGestureDetector headSwipeGestureDetector = new VerticalSwipeGestureDetector(JointType.Head, 45, 400, 0.45f, 0.4f, 400, 1800); this.gestureDetectors.Add(headSwipeGestureDetector); }