/// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(SceneManager screenManager, EventHandler loadNextScreen,
            bool loadingIsSlow)
        {
            // Tell all the current screens to transition off.
            foreach (Scene screen in screenManager.ActiveScenes)
                screen.ExitScreen(true);

            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, loadNextScreen);

            screenManager.ActivateScene(loadingScreen);
        }
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        protected LoadingScreen(SceneManager screenManager, bool loadingIsSlow,
            EventHandler loadNextScreen)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.loadNextScreen = loadNextScreen;

            BeginTime = TimeSpan.FromSeconds(0.5);

            if (loadingIsSlow)
            {
                backgroundThread = new Thread(BackgroundWorkerThread);
                backgroundThreadExit = new ManualResetEvent(false);

                graphicsDevice = screenManager.GraphicsDevice;
            }
        }
 private void SetSceneManager(SceneManager value)
 {
     sceneManager = value;
 }