Interface ISceneManager
- Namespace
- Gloam.Core.Interfaces
- Assembly
- Gloam.Core.dll
Interface for managing game scenes and their lifecycle
public interface ISceneManager
Properties
CurrentScene
Gets the currently active scene, if any
IScene? CurrentScene { get; }
Property Value
CurrentTransition
Gets the current scene transition, if any is active
ISceneTransition? CurrentTransition { get; }
Property Value
GlobalLayers
Gets the global layers that persist across scene changes
IReadOnlyList<ILayerRenderer> GlobalLayers { get; }
Property Value
Scenes
Gets all registered scenes
IReadOnlyDictionary<string, IScene> Scenes { get; }
Property Value
Methods
AddGlobalLayer(ILayerRenderer)
Adds a global layer that will persist across scene changes
void AddGlobalLayer(ILayerRenderer layer)
Parameters
layer
ILayerRendererThe global layer to add
RegisterScene(IScene)
Registers a scene with the manager
void RegisterScene(IScene scene)
Parameters
scene
ISceneThe scene to register
Exceptions
- ArgumentException
Thrown when a scene with the same name already exists
RemoveGlobalLayer(ILayerRenderer)
Removes a global layer
bool RemoveGlobalLayer(ILayerRenderer layer)
Parameters
layer
ILayerRendererThe global layer to remove
Returns
- bool
True if the layer was found and removed, false otherwise
SwitchToSceneAsync(string, ITransition?, CancellationToken)
Switches to the specified scene with a transition effect
ValueTask SwitchToSceneAsync(string sceneName, ITransition? transition, CancellationToken ct = default)
Parameters
sceneName
stringThe name of the scene to switch to
transition
ITransitionThe transition effect to use
ct
CancellationTokenCancellation token
Returns
- ValueTask
A ValueTask representing the scene switch operation
Exceptions
- ArgumentException
Thrown when the specified scene is not found
SwitchToSceneAsync(string, CancellationToken)
Switches to the specified scene
ValueTask SwitchToSceneAsync(string sceneName, CancellationToken ct = default)
Parameters
sceneName
stringThe name of the scene to switch to
ct
CancellationTokenCancellation token
Returns
- ValueTask
A ValueTask representing the scene switch operation
Exceptions
- ArgumentException
Thrown when the specified scene is not found
UnregisterScene(string)
Unregisters a scene from the manager
bool UnregisterScene(string sceneName)
Parameters
sceneName
stringThe name of the scene to unregister
Returns
- bool
True if the scene was found and removed, false otherwise
UpdateCurrentSceneAsync(CancellationToken)
Updates the current scene if one is active
ValueTask UpdateCurrentSceneAsync(CancellationToken ct = default)
Parameters
ct
CancellationTokenCancellation token
Returns
- ValueTask
A ValueTask representing the update operation