Ejemplo n.º 1
0
        private void LoadScene(string identifier, Dictionary <string, Object> parameters)
        {
            bool sceneFound = false;

            foreach (CEScene scene in Scenes)
            {
                foreach (ICESceneDrawable dr in scene.Drawables)
                {
                    dr.ToRemove = true;
                }

                if (scene.Identifier == identifier && !sceneFound)
                {
                    if (CurrentScene != null)
                    {
                        CurrentScene.OnQuit();
                    }

                    sceneFound = true;

                    CurrentScene = scene;

                    CurrentScene.Initialize();
                    CurrentScene.Load(parameters);
                }
            }

            if (!sceneFound)
            {
                Console.WriteLine("[CEGame] : The scene you're trying to load doesn't exist!");
            }
        }
Ejemplo n.º 2
0
        public void SwitchScene(Type type)
        {
            if (!type.IsSubclassOf(typeof(Scene)))
            {
                return;
            }

            var scene = (Scene)Activator.CreateInstance(type);

            CurrentScene?.UnloadContent();
            CurrentScene = (Scene)scene;
            CurrentScene.SetSceneManager(this);
            CurrentScene?.Initialize();
            CurrentScene?.LoadContent();
        }