public void Add(SceneBase scene, bool initializeAndLoadContent = false) { if (initializeAndLoadContent) { scene.Initialize(context); scene.LoadContent(); } Scenes.Add(scene); }
public void AddChild(SceneBase parent, SceneBase child, bool initializeAndLoadContent = false) { child.Parent = parent; if (initializeAndLoadContent) { child.Initialize(context); child.LoadContent(); } parent.SceneChildren.Add(child); }
private void UpdateTransition(GameTime gameTime) { var deltaTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds; if (_beginTransitionFade) { if (_transitionImage.Alpha < 1.0f) { _transitionImage.Alpha += deltaTime / 200f; } else { _beginTransitionFade = false; } } else { if (_mapTransition && _mapToLoad != null) { var mapId = _mapToLoad ?? MapManager.FirstMap; MapManager.Instance.LoadMap(Content, mapId); if (_mapLoadCallback != null) { _mapLoadCallback(mapId); _mapLoadCallback = null; } _mapToLoad = null; _mapTransition = false; } if (!_mapTransition && _newScene != null) { _currentScene.UnloadContent(); _currentScene = _newScene; _currentScene.LoadContent(); _newScene = null; } if (_transitionImage.Alpha > 0.0f) { _transitionImage.Alpha -= deltaTime / 200f; } else { _transitionImage.IsVisible = false; _isTransitioning = false; } } }
public void LoadContent(ContentManager Content) { this.Content = new ContentManager(Content.ServiceProvider, "Content"); var transitionTexture = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color); transitionTexture.SetData(new Color[] { Color.Black }); _transitionImage = new Sprite(transitionTexture); _transitionImage.Scale = new Vector2(VirtualSize.X, VirtualSize.Y); _transitionImage.Alpha = 0.0f; _transitionImage.IsVisible = false; _gameFont = Content.Load <BitmapFont>("fonts/SneakAttack"); _gameFontBig = Content.Load <BitmapFont>("fonts/SneakAttackBig"); SoundManager.Initialize(); _currentScene.LoadContent(); }
public void LoadContent(ContentManager Content) { this.Content = new ContentManager(Content.ServiceProvider, "Content"); var transitionTexture = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color); transitionTexture.SetData <Color>(new Color[] { Color.Black }); _transitionImage = new Sprite(transitionTexture); _transitionImage.Scale = new Vector2(VirtualSize.X, VirtualSize.Y); _transitionImage.Alpha = 0.0f; _transitionImage.IsVisible = false; _gameFont = Content.Load <BitmapFont>("fonts/Alagard"); _gameFontSmall = Content.Load <BitmapFont>("fonts/AlagardSmall"); _gameFontBig = Content.Load <BitmapFont>("fonts/AlagardBig"); ParticleManager = new ParticleManager <ParticleState>(1024 * 20, ParticleState.UpdateParticle); SoundManager.Initialize(); _currentScene.LoadContent(); }
private void UpdateTransition(GameTime gameTime) { var dt = gameTime.ElapsedGameTime.TotalMilliseconds; if (_beginTransitionFade) { if (_transitionImage.Alpha < 1.0f) { _transitionImage.Alpha += 0.1f; } else { _beginTransitionFade = false; } } else { if (_newScene != null) { _currentScene.UnloadContent(); _currentScene = _newScene; _currentScene.LoadContent(); _newScene = null; } if (_transitionImage.Alpha > 0.0f) { _transitionImage.Alpha -= 0.1f; } else { _transitionImage.IsVisible = false; _isTransitioning = false; } } }