Система перехода между сценами. И главное меню. Типа.
This commit is contained in:
parent
8e4304ebc6
commit
f45ebbceb6
7 changed files with 172 additions and 1 deletions
22
scripts/SceneManager.cs
Normal file
22
scripts/SceneManager.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class SceneManager : Node
|
||||
{
|
||||
[Export] public Dictionary<string, string> Scenes;
|
||||
|
||||
public string CurrentScene;
|
||||
|
||||
public void SwitchScene(string sceneName)
|
||||
{
|
||||
GetTree().ChangeSceneToFile(Scenes[sceneName]);
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
var scenePath = (string)ProjectSettings.GetSetting("application/run/main_scene");
|
||||
CurrentScene = Scenes.First(pair => pair.Value == scenePath).Key;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue