public void Start(string sceneName) { if (!_initialized) { _pendingScene = sceneName; return; } if (_sceneFactory == null) { _sceneFactory = Game.Services.GetService <ISceneFactory>(); if (_sceneFactory == null) { throw new Exception("an ISceneComposer service provider is required"); } } _outgoingScene = ActiveScene; var scene = _sceneFactory.Create(sceneName); var context = new Context( scene, this, _physicsManager, _inputManager, new ContentManager(Game.Content.ServiceProvider, Game.Content.RootDirectory), Game.GraphicsDevice); scene.Activate(context); ActiveScene = scene; SceneActivated?.Invoke(this, new SceneActivatedEventArgs() { Scene = scene }); }
/// <summary> /// Called when the scene is activated after a scene above it has /// completed. Does not get called the first time a scene is activated. /// </summary> protected virtual void OnSceneActivated() { SceneActivated?.Invoke(this, EventArgs.Empty); }
internal void Activate() { Active = true; SceneActivated?.Invoke(this); }