Table of Contents

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

IScene

CurrentTransition

Gets the current scene transition, if any is active

ISceneTransition? CurrentTransition { get; }

Property Value

ISceneTransition

GlobalLayers

Gets the global layers that persist across scene changes

IReadOnlyList<ILayerRenderer> GlobalLayers { get; }

Property Value

IReadOnlyList<ILayerRenderer>

Scenes

Gets all registered scenes

IReadOnlyDictionary<string, IScene> Scenes { get; }

Property Value

IReadOnlyDictionary<string, IScene>

Methods

AddGlobalLayer(ILayerRenderer)

Adds a global layer that will persist across scene changes

void AddGlobalLayer(ILayerRenderer layer)

Parameters

layer ILayerRenderer

The global layer to add

RegisterScene(IScene)

Registers a scene with the manager

void RegisterScene(IScene scene)

Parameters

scene IScene

The 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 ILayerRenderer

The 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 string

The name of the scene to switch to

transition ITransition

The transition effect to use

ct CancellationToken

Cancellation 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 string

The name of the scene to switch to

ct CancellationToken

Cancellation 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 string

The 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 CancellationToken

Cancellation token

Returns

ValueTask

A ValueTask representing the update operation