/// <summary> /// Removes a screen from the screen manager. You should normally /// use Screens.GameScreen.ExitScreen instead of calling this directly, so /// the screen can gradually transition off rather than just being /// instantly removed. /// </summary> public virtual void RemoveScreen(Screens.Screen screen) { if (inFullTransition && screens.Count == 1) { for (int i = 0; i < screensToLoad.Length; i++) AddScreen(screensToLoad[i], PlayerIndex.One); inFullTransition = false; screensToLoad = null; } // If we have a graphics device, tell the screen to unload content. screen.Deactivate(input); if (isInitialized) { screen.Unload(); } screens.Remove(screen); tempScreensList.Remove(screen); if (input.Kinect.IsEnabled()) { if (screen.KinectDependencies.Contains(Screens.KinectDependency.Skeleton) && ScreenHasDependency(Screens.KinectDependency.Skeleton)) input.Kinect.DisableSkeletalTracking(); if (screen.KinectDependencies.Contains(Screens.KinectDependency.Voice) && ScreenHasDependency(Screens.KinectDependency.Voice)) input.Kinect.DisableVoiceRecognition(); if (screen.KinectDependencies.Contains(Screens.KinectDependency.Color) && ScreenHasDependency(Screens.KinectDependency.Color)) input.Kinect.DisableColorCapture(); if (screen.KinectDependencies.Contains(Screens.KinectDependency.Depth) && ScreenHasDependency(Screens.KinectDependency.Depth)) input.Kinect.DisableDepthCapture(); } }