Buggy starting point
This commit is contained in:
@@ -4,13 +4,15 @@ using System;
|
||||
public partial class ChangeMenuInitiator : Node
|
||||
{
|
||||
float TransitionDelay = 0; // seconds
|
||||
Node cameFrom;
|
||||
string cameFrom;
|
||||
|
||||
public void ChangeMenu(string type, string destination, Node cameFromInput)
|
||||
public void ChangeMenu(string type, string destination, string cameFromInput)
|
||||
{
|
||||
cameFromInput = cameFrom;
|
||||
cameFrom = cameFromInput;
|
||||
|
||||
if (type == "SLOW")
|
||||
{
|
||||
GD.Print("slow switch");
|
||||
// Load the menu change manager
|
||||
var scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MenuChangeManager.tscn");
|
||||
var inst = (Node2D)scene.Instantiate();
|
||||
@@ -27,6 +29,7 @@ public partial class ChangeMenuInitiator : Node
|
||||
}
|
||||
if (type == "FAST")
|
||||
{
|
||||
GD.Print("fast switch");
|
||||
var scene = GD.Load<PackedScene>($"res://Assets/Scenes/MenusAndLevels/{destination}.tscn");
|
||||
var inst = (Node2D)scene.Instantiate();
|
||||
GetTree().Root.AddChild(inst);
|
||||
@@ -38,14 +41,13 @@ public partial class ChangeMenuInitiator : Node
|
||||
|
||||
DeleteMenu("LoadIn");
|
||||
}
|
||||
|
||||
}
|
||||
void DeleteMenu(StringName arg)
|
||||
{
|
||||
if (arg == "LoadIn")
|
||||
{
|
||||
// Delete current scene (MAKE SURE THE PARENT OF THE PARENT OF THIS SCRIPT IS THE SCENE)
|
||||
cameFrom.QueueFree();
|
||||
// Delete current scene that it came from
|
||||
GetTree().Root.GetNode(cameFrom).QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user