SceneTransition Rework completed
This commit is contained in:
@@ -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,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)
|
||||
|
||||
Reference in New Issue
Block a user