2025-05-24 23:50:06 +02:00
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
namespace Babushka.scripts.CSharp.Common;
|
|
|
|
|
|
|
|
|
|
public partial class SceneTransition : Node
|
|
|
|
|
{
|
|
|
|
|
[Export] private PackedScene _sceneToLoad;
|
2025-06-15 20:05:53 +02:00
|
|
|
[Export] private Node? _sceneInstanceParent;
|
2025-05-24 23:50:06 +02:00
|
|
|
[Export] private bool _unloadSelf = true;
|
|
|
|
|
|
|
|
|
|
public void LoadScene()
|
|
|
|
|
{
|
|
|
|
|
Node sceneInstance = _sceneToLoad.Instantiate();
|
2025-06-15 20:05:53 +02:00
|
|
|
if(_sceneInstanceParent != null)
|
|
|
|
|
_sceneInstanceParent.AddChild(sceneInstance);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GetTree().Root.AddChild(sceneInstance);
|
|
|
|
|
}
|
2025-05-24 23:50:06 +02:00
|
|
|
|
|
|
|
|
if (_unloadSelf)
|
|
|
|
|
{
|
|
|
|
|
QueueFree();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-15 20:05:53 +02:00
|
|
|
public void Quit()
|
|
|
|
|
{
|
|
|
|
|
GetTree().Quit();
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-24 23:50:06 +02:00
|
|
|
}
|