protected virtual void EndGame() { if (runningGame == null) return; KinectManager.Kinect.ColorFrameReady -= runningGame.OnKinectVideoFrameReady; KinectManager.Kinect.SkeletonFrameReady -= runningGame.OnKinectSkeletonFrameReady; KinectManager.Kinect.DepthFrameReady -= runningGame.OnKinectDepthFrameReady; runningGame.UnloadContent(); runningGame = null; }
protected virtual void StartGame(Type t) { try { KinectGame game = KinectGame.Create(t, new GameParameters(resolution, graphics, Window)); game.LoadContent(Content, GetContentRoot(t)); game.Initialize(); KinectManager.Kinect.ColorFrameReady += game.OnKinectVideoFrameReady; KinectManager.Kinect.SkeletonFrameReady += game.OnKinectSkeletonFrameReady; KinectManager.Kinect.SkeletonFrameReady += game.OnKinectSkeletonFrameReady; KinectManager.Kinect.DepthFrameReady += game.OnKinectDepthFrameReady; runningGame = game; } catch (Exception e) { Debug.WriteLine(e.Message); } }