Class Scene
A Scene is a collection of different manager classes that will handle the maintenance of the different Entity and Component instances that are associated with a given Scene.
Inherited Members
Namespace: Evergine.Framework
Assembly: Evergine.Framework.dll
Syntax
public class Scene : IdentifiableObject, ILoadable, IDisposable
  Remarks
Scene managers
- EntityManager handles the adding or removal of Entity instances.
 - BehaviorManager handles the update of Component instances.
 - RenderManager handles the drawing of Component instances.
 
- [Add Scene recipe](../recipes/Basic/Create-New-Scenes.md)
 - [Navigate Between Scenes recipe](../recipes/Basic/Navigate-Between-Scenes.md)
 - [Navigation Flow sample](https://github.com/Evergine/Samples/tree/master/Basic/NavigationFlow)
 
Constructors
Scene()
Initializes a new instance of the Scene class.
Declaration
public Scene()
  Fields
Name
The name of the scene.
Declaration
public string Name
  Field Value
| Type | Description | 
|---|---|
| string | 
Properties
IsDisposed
Gets a value indicating whether this instance is disposed.
Declaration
public bool IsDisposed { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
IsFinished
Gets a value indicating whether this instance is finished.
Declaration
public bool IsFinished { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
IsInitialized
Gets a value indicating whether this instance has been initialized.
Declaration
public bool IsInitialized { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
IsPaused
Gets a value indicating whether this instance is paused.
Declaration
public bool IsPaused { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
IsStarted
Gets a value indicating whether this instance has been started.
Declaration
public bool IsStarted { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
IsVisible
Gets or sets a value indicating whether this instance is visible.
Declaration
public bool IsVisible { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
Managers
Gets the scene managers.
Declaration
public SceneManagers Managers { get; }
  Property Value
| Type | Description | 
|---|---|
| SceneManagers | 
ReaderVersion
Gets the reader version.
Declaration
public Version ReaderVersion { get; }
  Property Value
| Type | Description | 
|---|---|
| Version | The reader version.  | 
      
SceneId
Gets the id of the asset to be loaded.
Declaration
public Guid SceneId { get; }
  Property Value
| Type | Description | 
|---|---|
| Guid | 
Speed
Gets or sets the speed factor at which this instance is updated. Its values are included in [0, infinity]. For example, a value of 2 will make the scene to run at 2x times.
Declaration
public float Speed { get; set; }
  Property Value
| Type | Description | 
|---|---|
| float | The speed factor at which this instance is updated.  | 
      
Remarks
This value can be used to create fast forward or bullet time effects.
Methods
CreateScene()
Creates the scene.
Declaration
protected virtual void CreateScene()
  Remarks
This method is called before all Entity instances in this instance are initialized.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
  Dispose(bool)
Releases unmanaged and - optionally - managed resources.
Declaration
protected virtual void Dispose(bool disposing)
  Parameters
| Type | Name | Description | 
|---|---|---|
| bool | disposing | 
  | 
      
Draw(TimeSpan)
Draw the scene.
Declaration
protected virtual void Draw(TimeSpan gameTime)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | gameTime | The game time.  | 
      
End()
Ends this instance.
Declaration
protected virtual void End()
  ~Scene()
Declaration
protected ~Scene()
  Initialize()
Initializes this instance.
Declaration
public virtual void Initialize()
  Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | If graphicsDevice is null.  | 
      
| ObjectDisposedException | If this instance has been disposed.  | 
      
Invalidate(ILoadable)
Invalidates this instance and raise the Invalidated event with the new ILoadable instance.
Declaration
public void Invalidate(ILoadable newInstance)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ILoadable | newInstance | The new ILoadable instance.  | 
      
NextStep(TimeSpan)
Update the scene one cycle.
Declaration
public void NextStep(TimeSpan gameTime)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | gameTime | The elapsed game time since the last update.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| ObjectDisposedException | If this instance has been disposed.  | 
      
Pause()
Pauses this instance.
Declaration
public virtual void Pause()
  Exceptions
| Type | Condition | 
|---|---|
| ObjectDisposedException | If this instance has been disposed.  | 
      
RegisterManagers()
Registers scene managers.
Declaration
public virtual void RegisterManagers()
  ReleaseUnusedMemory()
Release unused memory.
Declaration
public void ReleaseUnusedMemory()
  Resume()
Resumes this instance.
Declaration
public virtual void Resume()
  Exceptions
| Type | Condition | 
|---|---|
| ObjectDisposedException | If this instance has been disposed.  | 
      
Start()
Allows to perform custom code when this instance is started.
Declaration
protected virtual void Start()
  Remarks
This base method performs a layout pass.
Update(TimeSpan)
Updates the scene.
Declaration
protected virtual void Update(TimeSpan gameTime)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | gameTime | The game time.  | 
      
Events
Closed
Occurs when this instance has been closed.
Declaration
public event EventHandler Closed
  Event Type
| Type | Description | 
|---|---|
| EventHandler | 
Invalidated
Occurs when this instance has been invalidated and all references must be reloaded.
Declaration
public event EventHandler<ILoadable> Invalidated
  Event Type
| Type | Description | 
|---|---|
| EventHandler<ILoadable> | 
Paused
Occurs when this instance has been paused.
Declaration
public event EventHandler Paused
  Event Type
| Type | Description | 
|---|---|
| EventHandler | 
Resumed
Occurs when this instance has been resumed.
Declaration
public event EventHandler Resumed
  Event Type
| Type | Description | 
|---|---|
| EventHandler | 
Started
Occurs when this instance has been Started.
Declaration
public event EventHandler Started
  Event Type
| Type | Description | 
|---|---|
| EventHandler |