Add Godot project shell

This commit is contained in:
2026-04-21 18:54:38 +02:00
parent 0d9957fa62
commit 12a2868c9c
17 changed files with 424 additions and 6 deletions

View File

@@ -0,0 +1,59 @@
#nullable enable
using Godot;
using SideScrollerGame.Debug;
namespace SideScrollerGame.Bootstrap;
public partial class GameRoot : Node
{
public override void _Ready()
{
m_Settings = DebugSettings.Load();
GD.Seed((ulong)m_Settings.Seed);
GD.Print($"Debug boot: {m_Settings.BootMode}");
GD.Print($"Seed: {m_Settings.Seed}");
LoadBootScene(m_Settings.BootMode);
}
public void LoadBootScene(DebugBootMode bootMode)
{
PackedScene? scene = bootMode switch
{
DebugBootMode.Smoke => SmokeScene,
_ => MenuScene
};
string loadedSceneId = bootMode.ToString();
if (scene is null)
{
GD.PushError($"No scene configured for debug boot mode '{bootMode}'.");
return;
}
if (m_LoadedScene is not null)
{
m_LoadedScene.QueueFree();
}
m_LoadedScene = scene.Instantiate();
AddChild(m_LoadedScene);
DebugOverlay? overlay = GetNodeOrNull<DebugOverlay>("DebugOverlay");
if (overlay is not null && m_Settings is not null)
{
overlay.SetStatus(m_Settings, loadedSceneId);
}
}
[Export]
public PackedScene? MenuScene { get; set; }
[Export]
public PackedScene? SmokeScene { get; set; }
private Node? m_LoadedScene;
private DebugSettings? m_Settings;
}