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 static void Initialise()
        {
            CurrentScene = LevelScene.Instance;
            SceneType    = SceneTypes.LevelScene;

            Functions.LoadLevel(Data.CurrentLevel);
            Camera.Load();

            CurrentScene.Load();
        }
Ejemplo n.º 3
0
 public static void UpdateScenes()
 {
     if (NextScene != null)
     {
         CurrentScene.Unload();
         CurrentScene = NextScene;
         NextScene    = null;
         CurrentScene.Load();
     }
     CurrentScene.Update();
 }
Ejemplo n.º 4
0
        protected override void OnUpdate(GameTime gameTime)
        {
            time = gameTime;
            Camera.main.UpdateCamera(GraphicsDevice.Viewport);
            float elapsed = gameTime.ElapsedGameTime.Milliseconds / 16;

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Input.GetKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (Input.GetKeyDown(Keys.F12))
            {
                graphics.ToggleFullScreen();
            }

            if (Input.GetKeyDown(Keys.F1))
            {
                speed_hack = !speed_hack;
            }

            if (Input.GetKeyDown(Keys.C))
            {
                CurrentScene.Save();
            }
            if (Input.GetKeyDown(Keys.R))
            {
                CurrentScene.Load();
            }


            if (Input.GetMouseButton(0) && current_tilemap != null && !UIManager.IsOverUI())
            {
                Vector2 m_p = Camera.main.GetWorldPosition(Input.MousePosition);
                current_tilemap.layers[1].SetTile(current_tool == 1 ? tile : null, (int)m_p.X / current_tilemap.TileX, (int)m_p.Y / current_tilemap.TileY);
            }
        }
Ejemplo n.º 5
0
 public static void RestartCurrentScene()
 {
     CurrentScene.Unload();
     CurrentScene.Load();
 }