Ejemplo n.º 1
0
        internal void checkDrumHit(MainWindow.Player player, JointType joint)
        {
            //checkDrumHit code
            //MessageBox.Show(Convert.ToString(hitAreaStart[0][1]));
            if (player.skeleton != null && player.skeleton.Joints[joint].TrackingState == JointTrackingState.Tracked)
            {

                double posX = player.skeleton.Joints[joint].Position.X;
                double posY = player.skeleton.Joints[joint].Position.Y;
                double posZ = player.skeleton.Joints[joint].Position.Z;

                for (int i = 0; i <= hitArea[player.skeleton.TrackingId].Count - 1; i++)
                {
                    if (hitArea[player.skeleton.TrackingId][i].X1 < posX && hitArea[player.skeleton.TrackingId][i].X2 > posX && hitArea[player.skeleton.TrackingId][i].Y1 < posY && hitArea[player.skeleton.TrackingId][i].Y2 > posY && hitArea[player.skeleton.TrackingId][i].Z1 < posZ && hitArea[player.skeleton.TrackingId][i].Z2 > posZ)
                    {
                        if (!insideArea[player.skeleton.TrackingId][joint][i])
                        {
                            if (handMovements.difference != null)
                            {
                                if (handMovements.difference[player.skeleton.TrackingId][joint].Y < -0.01 || ((joint == JointType.FootLeft || joint == JointType.FootRight) && handMovements.difference[player.skeleton.TrackingId][joint].Z < -0.02))
                                {
                                    hitDrum("drum" + i);
                                    Debug.Print("HIT! " + i);
                                    insideArea[player.skeleton.TrackingId][joint][i] = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        insideArea[player.skeleton.TrackingId][joint][i] = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void checkStrum(MainWindow.Player player, JointType joint)
        {
            if (player != null && player.skeleton.Joints[joint].TrackingState == JointTrackingState.Tracked)
            {
                //Did the player strum just then?
                double posX = player.skeleton.Joints[joint].Position.X;
                double posY = player.skeleton.Joints[joint].Position.Y;
                double posZ = player.skeleton.Joints[joint].Position.Z;

                if (strumArea[player.skeleton.TrackingId].X1 < posX && strumArea[player.skeleton.TrackingId].X2 > posX && strumArea[player.skeleton.TrackingId].Y1 < posY && strumArea[player.skeleton.TrackingId].Y2 > posY && strumArea[player.skeleton.TrackingId].Z1 < posZ && strumArea[player.skeleton.TrackingId].Z2 > posZ)
                {
                    if (!insideStrumArea[player.skeleton.TrackingId])
                    {
                        if (handMovements.difference != null)
                        {
                            if (player.instrument == instrumentList.GuitarRight)
                            {
                                //Normal guitar stance
                                double strength;
                                if (handMovements.difference[player.skeleton.TrackingId][JointType.HandRight].Y > handMovements.difference[player.skeleton.TrackingId][JointType.HandRight].X)
                                {
                                    strength = Math.Abs(handMovements.difference[player.skeleton.TrackingId][JointType.HandRight].Y);
                                }
                                else
                                {
                                    strength = Math.Abs(handMovements.difference[player.skeleton.TrackingId][JointType.HandRight].X);
                                }

                                strumGuitar(checkNeckDist(player, JointType.HandLeft), player.mode);
                            }
                            else if (player.instrument == instrumentList.GuitarLeft)
                            {
                                //Lefty stance
                                double strength;
                                if (handMovements.difference[player.skeleton.TrackingId][JointType.HandLeft].Y > handMovements.difference[player.skeleton.TrackingId][JointType.HandLeft].X)
                                {
                                    strength = Math.Abs(handMovements.difference[player.skeleton.TrackingId][JointType.HandLeft].Y);
                                }
                                else
                                {
                                    strength = Math.Abs(handMovements.difference[player.skeleton.TrackingId][JointType.HandLeft].X);
                                }

                                strumGuitar(checkNeckDist(player, JointType.HandRight), player.mode);
                            }
                            insideStrumArea[player.skeleton.TrackingId] = true;
                        }
                    }
                }
                else
                {
                    insideStrumArea[player.skeleton.TrackingId] = false;
                }
            }
        }
Ejemplo n.º 3
0
        internal double checkNeckDist(MainWindow.Player player, JointType fretHand)
        {
            Joint hip = player.skeleton.Joints[JointType.Spine];
            Joint hand = player.skeleton.Joints[fretHand];

            double xLength = doPythag((hip.Position.Z - hand.Position.Z), (hip.Position.X - hand.Position.X));

            double neckDist = doPythag(xLength, (hip.Position.Y - hand.Position.Y));

            return neckDist;
        }
Ejemplo n.º 4
0
        internal void defineTriangleArea(MainWindow.Player player)
        {
            double triangleSize = 0.2; //Size of triangle edges (in metres)

            triangleArea[player.skeleton.TrackingId].X1 = player.skeleton.Joints[JointType.HandLeft].Position.X;
            triangleArea[player.skeleton.TrackingId].X2 = player.skeleton.Joints[JointType.HandLeft].Position.X + triangleSize;
            triangleArea[player.skeleton.TrackingId].Y1 = player.skeleton.Joints[JointType.HandLeft].Position.Y - triangleSize;
            triangleArea[player.skeleton.TrackingId].Y2 = player.skeleton.Joints[JointType.HandLeft].Position.Y;
            triangleArea[player.skeleton.TrackingId].Z1 = player.skeleton.Joints[JointType.HandLeft].Position.Z - (triangleSize * 2);
            triangleArea[player.skeleton.TrackingId].Z2 = player.skeleton.Joints[JointType.HandLeft].Position.Z + (triangleSize * 2);

            SetTrianglePosition(player);
        }
Ejemplo n.º 5
0
        internal void setupTriangle(MainWindow.Player player)
        {
            //Setting up guitar variables/runtimes
            if (!triangleArea.ContainsKey(player.skeleton.TrackingId))
            {
                triangleArea.Add(player.skeleton.TrackingId, new MainWindow.HitBox());
            }

            if (!insideTriangleArea.ContainsKey(player.skeleton.TrackingId))
            {
                insideTriangleArea.Add(player.skeleton.TrackingId, false);
            }
        }
Ejemplo n.º 6
0
        internal void defineKeyAreas(MainWindow.Player player)
        {
            if (player.skeleton != null)
            {
                //Drums
                defineKey(player, 0, -0.4592496, -0.14543834, -0.3577266);
                defineKey(player, 1, -0.3342496, -0.14543834, -0.3577266);
                defineKey(player, 2, -0.2092496, -0.14543834, -0.3577266);
                defineKey(player, 3, -0.0842496, -0.14543834, -0.3577266);
                defineKey(player, 4, 0.0407504, -0.14543834, -0.3577266);
                defineKey(player, 5, 0.1657504, -0.14543834, -0.3577266);
                defineKey(player, 6, 0.2907504, -0.14543834, -0.3577266);
                defineKey(player, 7, 0.4107504, -0.14543834, -0.3577266);

                SetKeyboardPosition(player);
            }
        }
Ejemplo n.º 7
0
        internal void defineHitAreas(MainWindow.Player player)
        {
            if (player.skeleton != null)
            {
                //Drums
                defineDrum(player, 0, -0.3035938, -0.0150525, -0.3892172);
                defineDrum(player, 1, 0.1035938, -0.0150525, -0.3892172);
                defineDrum(player, 2, -0.4431849, -0.15812907, -0.2434439);
                defineDrum(player, 3, 0.2913417, -0.15812907, -0.2434439);

                //Cymbal
                defineDrum(player, 4, -0.5374842, 0.2215563, -0.6076295, 0.3, 0.1, 0.5);
                defineDrum(player, 5, 0.30892, 0.2215563, -0.6076295, 0.3, 0.1, 0.5);

                //Kick drum
                defineDrum(player, 6, -0.3076267, -0.7402052, -0.8686381,0.6, 0.5, 0.6);

                SetDrumPosition(player);
            }
        }
Ejemplo n.º 8
0
        internal void checkKeyHit(MainWindow.Player player, JointType joint)
        {
            //checkDrumHit code
            //MessageBox.Show(Convert.ToString(hitAreaStart[0][1]));
            if (player.skeleton != null && player.skeleton.Joints[joint].TrackingState == JointTrackingState.Tracked)
            {

                double posX = player.skeleton.Joints[joint].Position.X;
                double posY = player.skeleton.Joints[joint].Position.Y;
                double posZ = player.skeleton.Joints[joint].Position.Z;

                for (int i = 0; i <= keyArea[player.skeleton.TrackingId].Count - 1; i++)
                {
                    if (keyArea[player.skeleton.TrackingId][i].X1 < posX && keyArea[player.skeleton.TrackingId][i].X2 > posX && keyArea[player.skeleton.TrackingId][i].Y1 < posY && keyArea[player.skeleton.TrackingId][i].Y2 > posY && keyArea[player.skeleton.TrackingId][i].Z1 < posZ && keyArea[player.skeleton.TrackingId][i].Z2 > posZ)
                    {
                        if (!insideKey[player.skeleton.TrackingId][joint][i])
                        {
                            if (handMovements.difference != null)
                            {
                                //MessageBox.Show(Convert.ToString(difference["X"]));
                                if (handMovements.difference[player.skeleton.TrackingId][joint].Y < 0 && (joint != JointType.FootLeft || joint != JointType.FootRight))
                                {
                                    hitKey("keyboard" + i);
                                    Debug.Print("HIT! " + i);
                                    insideKey[player.skeleton.TrackingId][joint][i] = true;
                                    showKeyboardOverlay(player, i);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (insideKey[player.skeleton.TrackingId][joint][i])
                        {
                            hideKeyboardOverlay(player, i);
                            insideKey[player.skeleton.TrackingId][joint][i] = false;
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public void checkTriangle(MainWindow.Player player, JointType joint)
        {
            if (player != null && player.skeleton.Joints[joint].TrackingState == JointTrackingState.Tracked)
            {
                //Did the player just ding the triangle?
                double posX = player.skeleton.Joints[joint].Position.X;
                double posY = player.skeleton.Joints[joint].Position.Y;
                double posZ = player.skeleton.Joints[joint].Position.Z;

                if (triangleArea[player.skeleton.TrackingId].X1 < posX && triangleArea[player.skeleton.TrackingId].X2 > posX && triangleArea[player.skeleton.TrackingId].Y1 < posY && triangleArea[player.skeleton.TrackingId].Y2 > posY && triangleArea[player.skeleton.TrackingId].Z1 < posZ && triangleArea[player.skeleton.TrackingId].Z2 > posZ)
                {
                    if (!insideTriangleArea[player.skeleton.TrackingId])
                    {
                        hitTriangle();
                        insideTriangleArea[player.skeleton.TrackingId] = true;
                    }
                }
                else
                {
                    insideTriangleArea[player.skeleton.TrackingId] = false;
                }
            }
        }
Ejemplo n.º 10
0
        //Primary player identification
        private void alignPrimaryGlow(MainWindow.Player player)
        {
            if (MainWindow.sensor.IsRunning)
            {
                ColorImagePoint leftPoint = MainWindow.sensor.MapSkeletonPointToColor(player.skeleton.Joints[JointType.HandLeft].Position, ColorImageFormat.RgbResolution640x480Fps30);
                ColorImagePoint rightPoint = MainWindow.sensor.MapSkeletonPointToColor(player.skeleton.Joints[JointType.HandRight].Position, ColorImageFormat.RgbResolution640x480Fps30);

                Canvas.SetLeft(imgPrimaryGlowLeft, leftPoint.X - (imgPrimaryGlowLeft.Width / 2));
                Canvas.SetTop(imgPrimaryGlowLeft, leftPoint.Y - (imgPrimaryGlowLeft.Height / 2));

                Canvas.SetLeft(imgPrimaryGlowRight, rightPoint.X - (imgPrimaryGlowRight.Width / 2));
                Canvas.SetTop(imgPrimaryGlowRight, rightPoint.Y - (imgPrimaryGlowRight.Height / 2));
            }
        }
Ejemplo n.º 11
0
 private void eightBitAudio(MainWindow.Player player)
 {
     wallAudio[player.skeleton.TrackingId][0] = "audio/wall/8bit/0.wav";
     wallAudio[player.skeleton.TrackingId][1] = "audio/wall/8bit/1.wav";
     wallAudio[player.skeleton.TrackingId][2] = "audio/wall/8bit/2.wav";
     wallAudio[player.skeleton.TrackingId][3] = "audio/wall/8bit/3.wav";
     wallAudio[player.skeleton.TrackingId][4] = "audio/wall/8bit/4.wav";
     wallAudio[player.skeleton.TrackingId][5] = "audio/wall/8bit/5.wav";
     wallAudio[player.skeleton.TrackingId][6] = "audio/wall/8bit/6.wav";
     wallAudio[player.skeleton.TrackingId][7] = "audio/wall/8bit/7.wav";
     wallAudio[player.skeleton.TrackingId][8] = "audio/wall/8bit/8.wav";
     wallAudio[player.skeleton.TrackingId][9] = "audio/wall/8bit/9.wav";
     wallAudio[player.skeleton.TrackingId][10] = "audio/wall/8bit/10.wav";
 }
Ejemplo n.º 12
0
 private void customAudio(MainWindow.Player player)
 {
     wallAudio[player.skeleton.TrackingId][0] = "audio/wall/create/0.wav";
     wallAudio[player.skeleton.TrackingId][1] = "audio/wall/create/1.wav";
     wallAudio[player.skeleton.TrackingId][2] = "audio/wall/create/2.wav";
     wallAudio[player.skeleton.TrackingId][3] = "audio/wall/create/3.wav";
     wallAudio[player.skeleton.TrackingId][4] = "audio/wall/create/4.wav";
     wallAudio[player.skeleton.TrackingId][5] = "audio/wall/create/5.wav";
     wallAudio[player.skeleton.TrackingId][6] = "audio/wall/create/6.wav";
     wallAudio[player.skeleton.TrackingId][7] = "audio/wall/create/7.wav";
     wallAudio[player.skeleton.TrackingId][8] = "audio/wall/create/8.wav";
     wallAudio[player.skeleton.TrackingId][9] = "audio/wall/create/9.wav";
     wallAudio[player.skeleton.TrackingId][10] = "audio/wall/create/10.wav";
 }
Ejemplo n.º 13
0
 private void boxSelection(MainWindow.Player player, int box, bool recording = false)
 {
     wallInteractionVisual(player, box);
 }
Ejemplo n.º 14
0
 private void boxRecordSelection(MainWindow.Player player, int box, bool recording = false)
 {
     Console.WriteLine("Selected box: " + box);
     boxToRecord = box.ToString();
     removeWallInteractionVisual(player);
     wallInteractionVisual(player, box, recording);
 }
Ejemplo n.º 15
0
 private void animalAudio(MainWindow.Player player)
 {
     wallAudio[player.skeleton.TrackingId][0] = "audio/wall/animal/0.wav";
     wallAudio[player.skeleton.TrackingId][1] = "audio/wall/animal/1.wav";
     wallAudio[player.skeleton.TrackingId][2] = "audio/wall/animal/2.wav";
     wallAudio[player.skeleton.TrackingId][3] = "audio/wall/animal/3.wav";
     wallAudio[player.skeleton.TrackingId][4] = "audio/wall/animal/4.wav";
     wallAudio[player.skeleton.TrackingId][5] = "audio/wall/animal/5.wav";
     wallAudio[player.skeleton.TrackingId][6] = "audio/wall/animal/6.wav";
     wallAudio[player.skeleton.TrackingId][7] = "audio/wall/animal/7.wav";
     wallAudio[player.skeleton.TrackingId][8] = "audio/wall/animal/8.wav";
     wallAudio[player.skeleton.TrackingId][9] = "audio/wall/animal/9.wav";
     wallAudio[player.skeleton.TrackingId][10] = "audio/wall/animal/10.wav";
 }
Ejemplo n.º 16
0
        private void wallUpdate(MainWindow.Player player)
        {
            //What we need to do every skeleton frame with respect to this player's Wall
            defineHitAreas(player);

            if (currentFocus == playerFocus.None)
            {
                checkBoxHit(player, JointType.HandLeft);
                checkBoxHit(player, JointType.HandRight);
            }

            setWallPosition(player);
        }
Ejemplo n.º 17
0
        internal void defineHitAreas(MainWindow.Player player)
        {
            if (player.skeleton != null)
            {
                //Front panels
                double panelHeight = 0.2;
                double panelWidth = panelHeight;
                double panelDepth = 0.1;

                definePanel(player, 0, -0.3516321, 0.1761248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 1, -0.1016321, 0.1761248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 2, 0.1516321, 0.1761248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 3, -0.3516321, -0.0861248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 4, -0.1016321, -0.0861248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 5, 0.1516321, -0.0861248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 6, -0.3516321, -0.3361248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 7, -0.1016321, -0.3361248, -0.4665765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 8, 0.1516321, -0.3361248, -0.4665765, panelHeight, panelWidth, panelDepth);

                //Side panels
                panelHeight = 0.5;
                panelDepth = 1;

                definePanel(player, 9, -0.5973037, -0.0743588, -0.5065765, panelHeight, panelWidth, panelDepth);
                definePanel(player, 10, 0.3473037, -0.0743588, -0.5065765, panelHeight, panelWidth, panelDepth);
            }
        }
Ejemplo n.º 18
0
        private double scaledWidth(MainWindow.Player player)
        {
            //y = 696.24e-0.007x

            //Player distance (Converted to centimetres)
            double distance = player.skeleton.Position.Z * 100;

            double width = 1112.5 * Math.Pow(Math.E, -0.006 * distance);

            return width;
        }
Ejemplo n.º 19
0
 private void beatboxAudio(MainWindow.Player player)
 {
     wallAudio[player.skeleton.TrackingId][0] = "audio/wall/beatbox/0.wav";
     wallAudio[player.skeleton.TrackingId][1] = "audio/wall/beatbox/1.wav";
     wallAudio[player.skeleton.TrackingId][2] = "audio/wall/beatbox/2.wav";
     wallAudio[player.skeleton.TrackingId][3] = "audio/wall/beatbox/3.wav";
     wallAudio[player.skeleton.TrackingId][4] = "audio/wall/beatbox/4.wav";
     wallAudio[player.skeleton.TrackingId][5] = "audio/wall/beatbox/5.wav";
     wallAudio[player.skeleton.TrackingId][6] = "audio/wall/beatbox/6.wav";
     wallAudio[player.skeleton.TrackingId][7] = "audio/wall/beatbox/7.wav";
     wallAudio[player.skeleton.TrackingId][8] = "audio/wall/beatbox/8.wav";
     wallAudio[player.skeleton.TrackingId][9] = "audio/wall/beatbox/9.wav";
     wallAudio[player.skeleton.TrackingId][10] = "audio/wall/beatbox/10.wav";
 }
Ejemplo n.º 20
0
 private void setupPlayerAudio(MainWindow.Player player)
 {
     wallAudio.Add(player.skeleton.TrackingId, new string[11]);
 }
Ejemplo n.º 21
0
 private void boxRecordStop(MainWindow.Player player)
 {
     Console.WriteLine("Stop recording");
     boxRecording = false;
     boxToRecord = null;
     removeWallInteractionVisual(player);
 }
Ejemplo n.º 22
0
        private void setupWall(MainWindow.Player player)
        {
            if (!hitArea.ContainsKey(player.skeleton.TrackingId))
            {
                //Blank dictionary of the drums of one person
                Dictionary<int, MainWindow.HitBox> blankDefinitions = new Dictionary<int, MainWindow.HitBox>();
                blankDefinitions.Add(0, new MainWindow.HitBox());
                blankDefinitions.Add(1, new MainWindow.HitBox());
                blankDefinitions.Add(2, new MainWindow.HitBox());
                blankDefinitions.Add(3, new MainWindow.HitBox());
                blankDefinitions.Add(4, new MainWindow.HitBox());
                blankDefinitions.Add(5, new MainWindow.HitBox());
                blankDefinitions.Add(6, new MainWindow.HitBox());
                blankDefinitions.Add(7, new MainWindow.HitBox());
                blankDefinitions.Add(8, new MainWindow.HitBox());
                blankDefinitions.Add(9, new MainWindow.HitBox());
                blankDefinitions.Add(10, new MainWindow.HitBox());

                hitArea.Add(player.skeleton.TrackingId, blankDefinitions);

                switch (player.mode)
                {
                    case MainWindow.PlayerMode.Custom:
                        customAudio(player);
                        break;
                    case MainWindow.PlayerMode.EightBit:
                        eightBitAudio(player);
                        break;
                    case MainWindow.PlayerMode.Sax:
                        saxAudio(player);
                        break;
                    case MainWindow.PlayerMode.Trance:
                        tranceAudio(player);
                        break;
                    case MainWindow.PlayerMode.Metal:
                        metalAudio(player);
                        break;
                    case MainWindow.PlayerMode.Animal:
                        animalAudio(player);
                        break;
                    case MainWindow.PlayerMode.Beatbox:
                        beatboxAudio(player);
                        break;
                }
            }

            //Make sure the hands aren't in the drums areas in the first place
            insideArea.Add(player.skeleton.TrackingId, createPlayerDictionary());
        }
Ejemplo n.º 23
0
        private void checkTutorial(MainWindow.Tutorials tutorial)
        {
            if (MainWindow.availableTutorials.ContainsKey(tutorial) && !MainWindow.availableTutorials[tutorial].seen)
            {
                MainCanvas.Children.Add(MainWindow.availableTutorials[tutorial].tutImage);
                MainWindow.availableTutorials[tutorial].tutImage.Width = MainCanvas.ActualWidth;
                imgDimmer.Visibility = System.Windows.Visibility.Visible;
                MainWindow.animateFade(imgDimmer, 0, 0.5, 0.5);
                MainWindow.animateFade(MainWindow.availableTutorials[tutorial].tutImage, 0, 1, 0.5);
                handMovements.LeftSwipeRight += dismissTutorial;

                MainWindow.hidePlayerOverlays();

                MainWindow.activeTutorial = tutorial;
                currentFocus = playerFocus.Tutorial;
                MainWindow.availableTutorials[tutorial].seen = true;
            }
        }
Ejemplo n.º 24
0
        internal void checkBoxRecordHit(MainWindow.Player player, JointType joint)
        {
            //checkDrumHit code
            if (player.skeleton != null)
            {

                double posX = player.skeleton.Joints[joint].Position.X;
                double posY = player.skeleton.Joints[joint].Position.Y;
                double posZ = player.skeleton.Joints[joint].Position.Z;

                for (int i = 0; i <= hitArea[player.skeleton.TrackingId].Count - 1; i++)
                {
                    if (hitArea[player.skeleton.TrackingId][i].X1 < posX && hitArea[player.skeleton.TrackingId][i].X2 > posX && hitArea[player.skeleton.TrackingId][i].Y1 < posY && hitArea[player.skeleton.TrackingId][i].Y2 > posY && hitArea[player.skeleton.TrackingId][i].Z1 < posZ && hitArea[player.skeleton.TrackingId][i].Z2 > posZ)
                    {
                        if (!insideArea[player.skeleton.TrackingId][joint][i])
                        {
                            if (handMovements.difference != null)
                            {
                                if (i <= 8 && handMovements.difference[player.skeleton.TrackingId][joint].Z < -0.01 || (i == 9 && handMovements.difference[player.skeleton.TrackingId][joint].X < -0.01) || (i == 10 && handMovements.difference[player.skeleton.TrackingId][joint].X > 0.01))
                                {
                                    //Hit - Selected, start recording, finish recording
                                    if (boxToRecord == null && !boxRecording)
                                    {
                                        //Select a box to record into
                                        boxRecordSelection(player, i);
                                    }
                                    else if (boxToRecord != null && !boxRecording)
                                    {
                                        //Record into this box
                                        if (boxToRecord == i.ToString())
                                        {
                                            if (!boxRecording)
                                            {
                                                boxRecordSelection(player, i, true);
                                                recordingTimer = new DispatcherTimer();
                                                recordingTimer.Interval = TimeSpan.FromSeconds(2);
                                                recordingTimer.Tick += new EventHandler(recordingTimer_Tick);
                                                recordingTimer.Start();

                                                var t = new Thread(new ParameterizedThreadStart((boxRecordStart)));
                                                t.Start(MainWindow.sensor);
                                            }
                                        }
                                        else
                                        {
                                            boxRecordSelection(player, i);
                                        }

                                    }
                                    /*else if (boxRecording)
                                    {
                                        //Stop recording
                                        boxRecordStop(player);
                                    }*/
                                    insideArea[player.skeleton.TrackingId][joint][i] = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        insideArea[player.skeleton.TrackingId][joint][i] = false;
                    }
                }
            }
        }
Ejemplo n.º 25
0
 private void definePanel(MainWindow.Player player, int panel, double X, double Y, double Z, double panelHeight = 0.2, double panelWidth = 0.2, double panelDepth = 0.2)
 {
     hitArea[player.skeleton.TrackingId][panel].X1 = player.skeleton.Joints[JointType.HipCenter].Position.X + X;
     hitArea[player.skeleton.TrackingId][panel].X2 = hitArea[player.skeleton.TrackingId][panel].X1 + panelWidth;
     hitArea[player.skeleton.TrackingId][panel].Y1 = player.skeleton.Joints[JointType.HipCenter].Position.Y + Y;
     hitArea[player.skeleton.TrackingId][panel].Y2 = hitArea[player.skeleton.TrackingId][panel].Y1 + panelHeight;
     hitArea[player.skeleton.TrackingId][panel].Z1 = player.skeleton.Joints[JointType.HipCenter].Position.Z + Z;
     hitArea[player.skeleton.TrackingId][panel].Z2 = hitArea[player.skeleton.TrackingId][panel].Z1 + panelDepth;
 }
Ejemplo n.º 26
0
        private void setWallPosition(MainWindow.Player player)
        {
            FrameworkElement image = player.instrumentImage;

            image.Width = scaledWidth(player);

            if (MainWindow.sensor.IsRunning)
            {
                ColorImagePoint point = MainWindow.sensor.MapSkeletonPointToColor(player.skeleton.Joints[JointType.Spine].Position, ColorImageFormat.RgbResolution640x480Fps30);

                //Grab the image reference and move it to the correct place
                Canvas.SetLeft(image, point.X - (image.ActualWidth / 2));
                Canvas.SetTop(image, point.Y - (image.ActualHeight / 2));

                if (player.instrumentOverlay != null)
                {
                    //If the player currently has an overlay to display, align that too
                    foreach (var overlay in player.instrumentOverlay)
                    {
                        image = overlay.Value;

                        image.Width = scaledWidth(player);

                        Canvas.SetLeft(image, point.X - (image.ActualWidth / 2));
                        Canvas.SetTop(image, point.Y - (image.ActualHeight / 2));
                    }
                }
            }
        }
Ejemplo n.º 27
0
        private void kinectGuideManipulation(MainWindow.Player player)
        {
            if (MainWindow.activeSkeletons.ContainsKey(player.skeleton.TrackingId))
            {
                if (handMovements.leftSwipeRightIn == null)
                {
                    //Manipulate the guide if we're not currently swiping to select
                    SkeletonPoint bodyMidpoint = player.skeleton.Joints[JointType.Spine].Position;

                    double angleValue = handMovements.getAngle(bodyMidpoint, player.skeleton.Joints[JointType.HandLeft].Position);

                    handMovements.scrollDirection oldDirection = menuScrollDirection;

                    double scaledValue = handMovements.distQuotient(0, 90, Math.Abs(90 - angleValue), 0, MainCanvas.ActualHeight / 2);

                    if (player.skeleton.Joints[JointType.HandLeft].Position.Y > bodyMidpoint.Y)
                    {
                        Canvas.SetTop(imgMenuMovementGuide, 250 - scaledValue);
                        imgMenuMovementGuide.Height = scaledValue;
                    }
                    else
                    {
                        imgMenuMovementGuide.Height = scaledValue;
                    }

                    menuScrollDirection = handMovements.sliderMenuValue(player, angleValue);

                    if (menuScrollDirection == handMovements.scrollDirection.None)
                    {
                        imgMenuMovementGuide.Opacity = 0.3;
                    }
                    else if (menuScrollDirection == handMovements.scrollDirection.SmallUp || menuScrollDirection == handMovements.scrollDirection.SmallDown)
                    {
                        imgMenuMovementGuide.Opacity = 0.6;
                    }
                    else
                    {
                        imgMenuMovementGuide.Opacity = 1;
                    }

                    if (oldDirection != menuScrollDirection)
                    {
                        adjustMenuSpeed(menuScrollDirection);

                        if ((oldDirection == handMovements.scrollDirection.None && menuScrollDirection == handMovements.scrollDirection.SmallUp) || (oldDirection == handMovements.scrollDirection.SmallUp && menuScrollDirection == handMovements.scrollDirection.LargeUp) || (oldDirection == handMovements.scrollDirection.None && menuScrollDirection == handMovements.scrollDirection.SmallDown) || (oldDirection == handMovements.scrollDirection.SmallDown && menuScrollDirection == handMovements.scrollDirection.LargeDown))
                        {
                            //If we're increasing in any direction, tick when the speed changes
                            menuTick();
                        }
                    }
                }
            }
            else
            {
                exitKinectGuide();
            }
        }
Ejemplo n.º 28
0
        private void wallInteractionVisual(MainWindow.Player player, int box, bool recording = false)
        {
            if (!player.instrumentOverlay.ContainsKey(box))
            {
                Image image = new Image();

                string url;

                if (recording)
                {
                    url = "images/wall-selection/wall" + box + "-rec.png";
                }
                else
                {
                    url = "images/wall-selection/wall" + box + ".png";
                }
                image.Source = new BitmapImage(new Uri(url, UriKind.Relative));

                player.instrumentOverlay.Add(box, image);
                MainCanvas.Children.Add(image);

                image.Width = scaledWidth(player);

                ColorImagePoint point = MainWindow.sensor.MapSkeletonPointToColor(player.skeleton.Joints[JointType.Spine].Position, ColorImageFormat.RgbResolution640x480Fps30);

                Canvas.SetLeft(image, point.X - (image.ActualWidth / 2));
                Canvas.SetTop(image, point.Y - (image.ActualHeight / 2));
            }
        }
Ejemplo n.º 29
0
 private void highlightPrimarySkeleton(MainWindow.Player player)
 {
     Storyboard sb = this.FindResource("primaryGlow") as Storyboard;
     sb.Begin();
 }
Ejemplo n.º 30
0
        private void wallSwitchPlayerTo(MainWindow.Player player, menuOptions option)
        {
            removeWallInteractionVisual(player);

            if (MainWindow.activeSkeletons.ContainsKey(player.skeleton.TrackingId))
            {
                switch (option)
                {
                    case menuOptions.RecordNewWall:
                        bool stop = false;
                        foreach (var person in MainWindow.activeSkeletons)
                        {
                            if (person.Value.mode == MainWindow.PlayerMode.Create)
                            {
                                stop = true;
                            }
                        }
                        if (!stop)
                        {
                            player.mode = MainWindow.PlayerMode.Create;
                            checkTutorial(MainWindow.Tutorials.RecordNewWall);
                        }
                        break;
                    case menuOptions.CustomWall:
                        player.mode = MainWindow.PlayerMode.Custom;
                        customAudio(player);
                        break;
                    case menuOptions.Sax:
                        player.mode = MainWindow.PlayerMode.Sax;
                        saxAudio(player);
                        break;
                    case menuOptions.Trance:
                        player.mode = MainWindow.PlayerMode.Trance;
                        tranceAudio(player);
                        break;
                    case menuOptions.Metal:
                        player.mode = MainWindow.PlayerMode.Metal;
                        metalAudio(player);
                        break;
                    case menuOptions.EightBit:
                        player.mode = MainWindow.PlayerMode.EightBit;
                        eightBitAudio(player);
                        break;
                    case menuOptions.Animal:
                        player.mode = MainWindow.PlayerMode.Animal;
                        animalAudio(player);
                        break;
                    case menuOptions.Beatbox:
                        player.mode = MainWindow.PlayerMode.Beatbox;
                        beatboxAudio(player);
                        break;
                }
            }
        }