47 lines
922 B
C#
47 lines
922 B
C#
using Godot;
|
|
using Polonium.Attributes;
|
|
using Polonium.Interfaces;
|
|
|
|
namespace GlobalClasses;
|
|
[ProxyNode]
|
|
[GlobalClass]
|
|
[Tool]
|
|
[RegistryEntity]
|
|
public partial class RootScene : Scene
|
|
{
|
|
private Scene CurrentScene { get; set; }
|
|
|
|
public void SwitchScene(Scene scene)
|
|
{
|
|
if (CurrentScene != null)
|
|
RemoveChild(CurrentScene);
|
|
AddChild(scene);
|
|
CurrentScene = scene;
|
|
}
|
|
|
|
public override void _Ready()
|
|
{
|
|
GlobalRegistry.RootScene = this;
|
|
base._Ready();
|
|
}
|
|
|
|
[ProxyMethod]
|
|
public virtual void Enter()
|
|
{
|
|
}
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
Enter();
|
|
base._EnterTree();
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if(!GlobalRegistry.Paused)
|
|
foreach (ITimeConsumer tc in GlobalRegistry.TimeConsumers)
|
|
tc.Process(delta);
|
|
base._Process(delta);
|
|
}
|
|
}
|