ini
This commit is contained in:
46
Scenes/MainScene.cs
Normal file
46
Scenes/MainScene.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class MainScene : Node2D
|
||||
{
|
||||
public Node CurrentScene { get; set; }
|
||||
public VirtualChemDemo Demo { get; set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GlobalScene.MainScene = this;
|
||||
Demo = GetNode<VirtualChemDemo>("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)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user