-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneManager.cs
More file actions
40 lines (33 loc) · 862 Bytes
/
Copy pathSceneManager.cs
File metadata and controls
40 lines (33 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using SoftyEngine.ECS;
namespace Softine;
public class SceneManager()
{
private Scene _currentScene;
private readonly Dictionary<string, Scene> _scenes = new();
private List<ISystem> systems;
private List<IPhysicsSystem> physicsSystems;
public void AddScene(Scene scene)
{
_scenes[scene.Name] = scene;
_currentScene ??= scene;
}
public void SwitchScene(string name)
{
if (_scenes.TryGetValue(name, out var scene))
{
_currentScene = scene;
}
else
{
throw new Exception($"Scene '{name}' does not exist");
}
}
public void Update(float deltaTime)
{
_currentScene?.Update(deltaTime);
}
public void FixedUpdate(float fixedDeltaTime)
{
_currentScene?.FixedUpdate(fixedDeltaTime);
}
}