Add scene transitions (fade, wipe) to SceneManager

Switch(scene, transition) covers the old scene, swaps at full coverage
(hiding slow OnLoad), then reveals the new one. Built-in Fade and Wipe
transitions draw through TransitionRenderer (BasicEffect quad, no
SpriteBatch); custom transitions subclass Transition. Runs on unscaled
time so it works while gameplay is paused; Switch during a transition
replaces the pending target.

Sample: Tab now fades into the stress scene and wipes back.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-06-11 04:27:54 +03:00
co-authored by Claude Fable 5
parent ff2231a8ab
commit 2b7d4c4fef
8 changed files with 338 additions and 15 deletions
+4 -4
View File
@@ -82,9 +82,9 @@ public sealed class BounceSystem(RectF bounds) : QuerySystem<Transform2D, Veloci
}
}
/// <summary>Пауза (P), музыка (M), переключение сцены (Tab).</summary>
/// <summary>Пауза (P), музыка (M), переключение сцены с переходом (Tab).</summary>
public sealed class SceneHotkeysSystem(
EngineContext context, ActionMap<SampleAction> actions, Func<Scene> nextScene) : BaseSystem
EngineContext context, ActionMap<SampleAction> actions, Func<Scene> nextScene, Transition transition) : BaseSystem
{
protected override void OnUpdateGroup()
{
@@ -106,9 +106,9 @@ public sealed class SceneHotkeysSystem(
}
}
if (actions.IsPressed(SampleAction.SwitchScene))
if (actions.IsPressed(SampleAction.SwitchScene) && !context.Scenes.IsTransitioning)
{
context.Scenes.Switch(nextScene());
context.Scenes.Switch(nextScene(), transition);
}
}
}