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!"); } }
public static void Initialise() { CurrentScene = LevelScene.Instance; SceneType = SceneTypes.LevelScene; Functions.LoadLevel(Data.CurrentLevel); Camera.Load(); CurrentScene.Load(); }
public static void UpdateScenes() { if (NextScene != null) { CurrentScene.Unload(); CurrentScene = NextScene; NextScene = null; CurrentScene.Load(); } CurrentScene.Update(); }
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); } }
public static void RestartCurrentScene() { CurrentScene.Unload(); CurrentScene.Load(); }