Class Scene
A Scene is a collection of different manager classes that handle the maintenance of the different Entity and Component instances associated with a given Scene.
Implements
Namespace: Evergine.Framework
Assembly: Evergine.Framework.dll
Syntax
public class Scene : IdentifiableObject, ILoadable
Remarks
Scene managers
- EntityManager handles the addition or removal of Entity instances.
- BehaviorManager handles the updating 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 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 manager.
Declaration
public SceneManagers Managers { get; }
Property Value
Type | Description |
---|---|
SceneManagers |
ReaderVersion
Gets the reader's version.
Declaration
public Version ReaderVersion { get; }
Property Value
Type | Description |
---|---|
Version | The reader's 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 within the range [0, infinity]. For example, a value of 2 will make the scene run at 2x speed.
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 scene are initialized.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Releases unmanaged resources and optionally managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
|
Draw(TimeSpan)
Draws 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 | Thrown if graphicsDevice is null. |
ObjectDisposedException | Thrown if this instance has been disposed. |
Invalidate(ILoadable)
Invalidates this instance and raises 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)
Updates 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 | Thrown if this instance has been disposed. |
RegisterManagers()
Registers the scene managers.
Declaration
public virtual void RegisterManagers()
ReleaseUnusedMemory()
Releases unused memory.
Declaration
public void ReleaseUnusedMemory()
Resume()
Resumes this instance.
Declaration
public virtual void Resume()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | Thrown if this instance has been disposed. |
Start()
Allows performing 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's current time. |
Events
Closed
Occurs when this instance is closed.
Declaration
public event EventHandler Closed
Event Type
Type | Description |
---|---|
EventHandler |
Invalidated
Occurs when this instance is invalidated and all references must be reloaded.
Declaration
public event EventHandler<ILoadable> Invalidated
Event Type
Type | Description |
---|---|
EventHandler<ILoadable> |
Paused
Occurs when this instance is paused.
Declaration
public event EventHandler Paused
Event Type
Type | Description |
---|---|
EventHandler |
Resumed
Occurs when this instance is resumed.
Declaration
public event EventHandler Resumed
Event Type
Type | Description |
---|---|
EventHandler |
Started
Occurs when this instance has started.
Declaration
public event EventHandler Started
Event Type
Type | Description |
---|---|
EventHandler |