Пример #1
0
 public void Detatch(GameScene scene)
 {
     if (scenes.Contains(scene))
     {
         scene.Manager = null;
         scenes.Remove(scene);
     }
     else
         Log.Write(this, "Scene being removed was not found in the list of scenes.", LogLevels.Warning);
 }
Пример #2
0
 public void Attach(GameScene scene)
 {
     if (!scenes.Contains(scene))
     {
         scene.Manager = this;
         scenes.Add(scene);
     }
     else
         Log.Write(this, "Scene being added was already found in the list of scenes.", LogLevels.Warning);
 }
Пример #3
0
        public override void Unload(ContentCache cache)
        {
            Log.Write(this, "Removing the old scene's camera from the engine.");
            Game.Components.Remove(currentScene.Camera);

            currentScene.Unload(Game.Cache);
            currentScene = null;
        }
Пример #4
0
        public void SwitchCurrent(GameScene newCurrent)
        {
            Throw.IfNull(this, "newCurrent", newCurrent);

            if (newCurrent == currentScene)
            {
                Log.Write(this, "Scene already loaded!", LogLevels.Warning);
                return;
            }

            Log.Write(this, "Switching current scene.");

            if (currentScene != null)
            {
                Log.Write(this, "Removing the old scene's camera from the engine.");
                Game.Components.Remove(currentScene.Camera);

                currentScene.Unload(Game.Cache);
            }

            currentScene = newCurrent;

            if (currentScene != null)
            {
                currentScene.Load(Game.Cache);

                Log.Write(this, "Adding the new scene's camera to the game engine.");
                Game.Components.Add(currentScene.Camera);
            }
        }