using Godot;
using System;

public partial class SceneManager : Node
{
	PackedScene principal ;
	PackedScene city;
	Node actuel;


	[Signal] public delegate void ToPrincipalEventHandler();
	[Signal] public delegate void ToCityEventHandler();
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		Callable PrincipalCallable = new Callable(this, MethodName.ToPrincipalFunc);
		Connect(SignalName.ToPrincipal, PrincipalCallable);

		Callable CityCallable = new Callable(this, MethodName.ToCityFunc);
		Connect(SignalName.ToCity, CityCallable);
		
		
		principal = (PackedScene)ResourceLoader.Load("res://scene/principal.tscn");
		city = (PackedScene)ResourceLoader.Load("res://scene/city.tscn");
		actuel = principal.Instantiate();
		AddChild(actuel);

	}

    public void ToPrincipalFunc()
	{
		actuel.QueueFree();
		actuel = principal.Instantiate();
		AddChild(actuel);
	}

	public void ToCityFunc()
	{
		actuel.QueueFree();
		actuel = city.Instantiate();
		AddChild(actuel);
	}
}
