Files

32 lines
667 B
C#
Raw Permalink Normal View History

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;
[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);
}
if (_unloadSelf)
{
QueueFree();
}
}
2025-06-15 20:05:53 +02:00
public void Quit()
{
GetTree().Quit();
}
}