SceneTransition Rework completed

This commit is contained in:
2025-07-10 23:23:20 +02:00
parent 16251db248
commit 480d149ede
10 changed files with 155 additions and 118 deletions
@@ -1,7 +1,7 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.SceneManagement;
public partial class SceneTransitionThreaded : Node2D
public partial class SceneTransitionThreaded : CanvasLayer
{
public static SceneTransitionThreaded Instance { get; private set; }
+1 -16
View File
@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Babushka.scripts.CSharp.Common.SceneManagement;
using Godot;
@@ -6,27 +5,13 @@ namespace Babushka.scripts.CSharp.Common;
public partial class SceneTransition : Node
{
[Export] private PackedScene _sceneToLoad;
[Export] private string[] _sceneNamesToLoad;
[Export] private int _sceneIndex;
[Export] private Node? _sceneInstanceParent;
[Export] private bool _unloadSelf = true;
// todo: remove and replace with indexed system
public void LoadScene()
{
Node sceneInstance = _sceneToLoad.Instantiate();
if(_sceneInstanceParent != null)
_sceneInstanceParent.AddChild(sceneInstance);
else
{
GetTree().Root.AddChild(sceneInstance);
}
if (_unloadSelf)
{
QueueFree();
}
LoadSceneAtIndex(0);
}
public void LoadSceneAtIndex(int index)