public override void Update(GameTime gameTime) { // hand.Update(gameTime); //button.Update(gameTime); //button.Clicked += button_Clicked; gesture = kinect.Gesture; if (FrameNumber % 240 == 0) { kinect.Gesture = ""; tvPopup.message = ""; } if (FrameNumber % 120 == 0) joiningHands = false; if (voiceCommands != null) { if (voiceCommands.HeardString.Equals("Open")) { shouldPlay = true; foreach (var player in players) player.IsMuted = false; } if (voiceCommands.HeardString.Equals("Close")) { shouldPlay = false; foreach (var player in players) player.IsMuted = true; } } //if (gesture.Equals("Zoom out")) // joiningHands = true; if (gesture.Equals("Joined Zoom")) { if (shouldPlay) { shouldPlay = false; //player.Volume = 0; foreach (var player in players) player.IsMuted = true; } else { shouldPlay = true; //player.Volume = tv.Volume / 100f; foreach (var player in players) player.IsMuted = false; } kinect.Gesture = ""; } if(joinZoom!=null) if (joinZoom.currentGesturePart >= 1 && joinZoom.currentGesturePart <= 10) joiningHands = true; if (joiningHands) suppressUiTimer = 2; if (suppressUiTimer > 0) suppressUiTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds; skel = kinect.trackedSkeleton; if ((skel != null)) //&& skel.Joints[JointType.WristLeft].Position.Y > skel.Joints[JointType.ElbowLeft].Position.Y) && //skel.Joints[JointType.WristRight].Position.Y > skel.Joints[JointType.ElbowRight].Position.Y) { leftAngle = skel.GetRotationZ2(JointType.WristLeft, JointType.HipLeft) + 0.32f; if (skel.GetDistanceY(JointType.WristLeft, JointType.HipLeft) < 0) leftAngle -= MathHelper.Pi; leftAngle = MathHelper.Clamp(leftAngle, -MathHelper.PiOver2, MathHelper.PiOver2); leftDist = skel.GetDistance(JointType.WristLeft, JointType.HipLeft, 'z') - 0.2f; rightAngle = skel.GetRotationZ2(JointType.WristRight, JointType.HipRight) - 0.32f; if (skel.GetDistanceY(JointType.WristRight, JointType.HipRight) < 0) rightAngle += MathHelper.Pi; rightAngle = MathHelper.Clamp(rightAngle, -MathHelper.PiOver2, MathHelper.PiOver2); rightDist = skel.GetDistance(JointType.WristRight, JointType.HipRight, 'z') - 0.2f; if (suppressUiTimer > 0 || !shouldPlay) { leftDist = 0; rightDist = 0; } var lastCh = tv.Channel; tv.UpdateValues(leftAngle, rightAngle, leftDist > 0, rightDist > 0); foreach (var player in players) player.Volume = (float)tv.Volume / 100; if (tv.Channel != lastCh) { currentPlayer.Pause(); currentPlayer = players[tv.Channel - 1]; currentPlayer.Resume(); } tvPopup.message = tv.Status; } base.Update(gameTime); }