Files
Polonium/src/Scenes/RootScene.cs
2025-02-12 14:09:56 +00:00

45 lines
921 B
C#

using Godot;
using Polonium.Attributes;
using Polonium.Interfaces;
namespace Polonium.Scenes;
[ProxyNode]
public partial class RootScene : Node2D
{
private Scene CurrentScene { get; set; }
public void SwitchScene(Scene scene)
{
if (CurrentScene != null)
RemoveChild(CurrentScene);
AddChild(scene);
CurrentScene = scene;
}
public override void _Ready()
{
PoloniumRegistry.Instance.RootScene = this;
base._Ready();
}
[ProxyMethod]
public virtual void Enter()
{
}
public override void _EnterTree()
{
Enter();
base._EnterTree();
}
public override void _Process(double delta)
{
if(!PoloniumRegistry.Instance.Paused)
foreach (ITimeConsumer tc in PoloniumRegistry.Instance.TimeConsumers)
tc.Process(delta);
base._Process(delta);
}
}