public bool GoInDirection(PathSelectionComponent.PathDirection direction)
 {
     switch (direction)
     {
         case PathSelectionComponent.PathDirection.Back:
             {
                 if (mapPositionY > 0) mapPositionY--;
                 else return false;
             }
             break;
         case PathSelectionComponent.PathDirection.Forward:
             {
                 if (mapPositionY < 2) mapPositionY++;
                 else return false;
             }
             break;
         case PathSelectionComponent.PathDirection.Left:
             {
                 if (mapPositionX > 0) mapPositionX--;
                 else return false;
             }
             break;
         case PathSelectionComponent.PathDirection.Right:
             {
                 if (mapPositionX < 2) mapPositionX++;
                 else return false;
             }
             break;
     }
     currentRoom = gameMap[mapPositionX, mapPositionY];
     return true;
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            kinectManager = new KinectManager(kinectDisplay, mainCanvas, kinectCanvas);
            kinectManager.SkeletonFound += new Action(kinectManager_SkeletonFound);
            kinectManager.Initialize();

            //This should probablly be moved into some sort of controller.
            //GestureDetectors and PostureDetectors can be swapped in and out if necessary.
            pathSelector = new PathSelectionComponent(mainCanvas);
            pathSelector.IsEnabled = false;
            pathSelector.PathSelected += new EventHandler<PathSelectionComponent.PathSelectedEventArgs>(pathSelector_PathSelected);
            kinectManager.KinectConnected += kinectManager_KinectConnected;
            kinectManager.PostureDetector = new CombatPostureDetector();
            kinectManager.PostureDetector.PostureDetected += new Action<string>(PostureDetector_PostureDetected);
            kinectManager.GestureDetector = slashDetector;
            kinectManager.GestureDetector.OnGestureDetected += new Action<string>(GestureDetector_OnGestureDetected);
            //kinectManager.GestureDetector.TraceTo(mainCanvas, System.Windows.Media.Color.FromRgb(255, 0, 0));
            kinectManager.GestureDetector.MinimalPeriodBetweenGestures = 2000;
            kinectManager.GestureUpdate += new Action<Point>(kinectManager_GestureUpdate);
            kinectManager.CursorUpdate += new Action<Point, Point>(kinectManager_CursorUpdate);
            kinectManager.CursorUpdatable = pathSelector;
            /** **/

            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            attackIndicator = new AttackIndicator(mainCanvas);
            mapDisplay = new MapDisplay(mainCanvas, game);
            lifeDisplay = new LifeDisplay(mainCanvas, game);
        }
 void pathSelector_PathSelected(object sender, PathSelectionComponent.PathSelectedEventArgs e)
 {
     pathSelector.IsEnabled = false;
     //MessageBox.Show(e.Direction.ToString());
     // Go to the next room
     bool didGo = game.GoInDirection(e.Direction);
     if (didGo) mapDisplay.Hide();
     if (!didGo) PrintLine("Invalid Direction.");
     // Start the room
     NextTurn();
 }