You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
667 B
32 lines
667 B
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common;
|
|
|
|
public partial class SceneTransition : Node
|
|
{
|
|
[Export] private PackedScene _sceneToLoad;
|
|
[Export] private Node? _sceneInstanceParent;
|
|
[Export] private bool _unloadSelf = true;
|
|
|
|
public void LoadScene()
|
|
{
|
|
Node sceneInstance = _sceneToLoad.Instantiate();
|
|
if(_sceneInstanceParent != null)
|
|
_sceneInstanceParent.AddChild(sceneInstance);
|
|
else
|
|
{
|
|
GetTree().Root.AddChild(sceneInstance);
|
|
}
|
|
|
|
if (_unloadSelf)
|
|
{
|
|
QueueFree();
|
|
}
|
|
}
|
|
|
|
public void Quit()
|
|
{
|
|
GetTree().Quit();
|
|
}
|
|
|
|
} |