Пример #1
0
        private void ProcessSkeleton(Skeleton skeleton)
        {
////            DATA1.Content = $"Left Hand X: {skeleton.Joints[JointType.HandLeft].Position.X}";
            var handLeftY = skeleton.Joints[JointType.HandLeft].Position.Y;
            var handLeftX = skeleton.Joints[JointType.HandLeft].Position.X;
//
//
//            DATA2.Content = $"Left Hand Y: {handLeftY}";
            var positionZ = skeleton.Joints[JointType.ShoulderCenter].Position.Z;

//            DATA1.Content = $"CENTER Z: {positionZ}";

            DATA1.Content = $"Default height {defaultHandHeight}";
            DATA2.Content = $"Max Height {maxHeight}";
            DATA3.Content = $"X {padMinX} - {padMaxX}";
            DATA4.Content = $"Y {padMinY} - {padMaxY}";

            //constraints
            bool isTooFar  = positionZ > maxZ;
            bool isTooNear = positionZ < minZ;

            if (isTooFar)
            {
                SetStatus(StatusKeySkeleton, StatusIsTooFar);
            }

            if (isTooNear)
            {
                SetStatus(StatusKeySkeleton, StatusIsTooNear);
            }

            bool willBeValid = !(isTooNear || isTooFar);

            if (willBeValid && players.Count > 0 && players[players.Keys.ElementAt(0)].IsAlive)
            {
                SetStatus(StatusKeySkeleton, StatusSkeletonOkay);
            }

            isValidState = willBeValid;


            var xy = GetXYPadData(skeleton);

            SendXY(xy.Item1, xy.Item2);
            midiMaster.SendXY((byte)xy.Item1, (byte)xy.Item2);

//            DATA3.Content = $"X: {xy.Item1}";
//            DATA4.Content = $"Y: {xy.Item2}";


//            if(calib)
            if (CalibrationStep == CalibrationSteps.KEYBOARD_HEIGHT)
            {
                defaultHandHeight = handLeftY;
            }
            else if (CalibrationStep == CalibrationSteps.RAISE_HAND_HEIGHT)
            {
                maxHeight = handLeftY;
            }
            else if (CalibrationStep == CalibrationSteps.XY)
            {
                padMinX = Math.Min(handLeftX, padMinX);
                padMinY = Math.Min(handLeftY, padMinY);
                padMaxX = Math.Max(handLeftX, padMaxX);
                padMaxY = Math.Max(handLeftY, padMaxY);
            }
            swipeThrottle.UpdateThrottle();
        }