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:
co-authored by
Claude Fable 5
parent
ff2231a8ab
commit
2b7d4c4fef
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user