Scene Class
Base class for game scenes. Override OnLoadAsync, OnEnter, OnUpdate, OnRender, OnExit, and OnUnloadAsync to implement scene logic. Framework properties (Logger, World, Renderer, Input, Audio, Game) are set automatically before OnLoadAsync is called.
public abstract class Scene : Brine2D.Engine.SceneBase
Inheritance System.Object → SceneBase → Scene
Derived
↳ DefaultFallbackScene
Example¶
protected override void OnEnter()
{
var player = World.CreateEntity("Player")
.AddComponent<TransformComponent>()
.AddBehavior<PlayerMovementBehavior>();
Audio.PlayMusic("theme.ogg");
World.GetSystem<ParticleSystem>()!.IsEnabled = false;
}
| Properties | |
|---|---|
| World | Entity world for this scene. Available from OnLoadAsync onwards. Virtual to allow test doubles to substitute a lightweight world without a real ECS setup. |