47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class MainScene : Node2D
|
|
{
|
|
public Node CurrentScene { get; set; }
|
|
public VirtualChemistryDemo Demo { get; set; }
|
|
|
|
public override void _Ready()
|
|
{
|
|
GlobalScene.MainScene = this;
|
|
Demo = GetNode<VirtualChemistryDemo>("Demo");
|
|
CurrentScene = Demo;
|
|
}
|
|
|
|
public void SwitchToConstructor()
|
|
{
|
|
if (CurrentScene == GlobalScene.CompoundConstructor)
|
|
return;
|
|
if (CurrentScene != Demo)
|
|
throw new Exception("?");
|
|
if (GlobalScene.CompoundConstructor == null)
|
|
GlobalScene.CompoundConstructor = ResourceLoader
|
|
.Load<PackedScene>("res://Scenes/CompoundConstructor.tscn")
|
|
.Instantiate<CompoundConstructor>();
|
|
RemoveChild(Demo);
|
|
AddChild(GlobalScene.CompoundConstructor);
|
|
CurrentScene = GlobalScene.CompoundConstructor;
|
|
}
|
|
|
|
public void SwitchToDemo()
|
|
{
|
|
if (CurrentScene == Demo)
|
|
return;
|
|
if (CurrentScene != GlobalScene.CompoundConstructor)
|
|
throw new Exception("?");
|
|
RemoveChild(CurrentScene);
|
|
AddChild(Demo);
|
|
CurrentScene = Demo;
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
}
|
|
}
|