Remove unnecessary PlayMode enum

This commit is contained in:
Simon Lübeß
2026-09-13 21:16:09 +02:00
parent 8244033ac5
commit 8e9efbb367
+8 -17
View File
@@ -842,7 +842,7 @@ namespace GlitchyEditor
// In simulation mode we don't want any scripts to run, just physics.
_editorScene.CopyTo(runtimeScene, _sceneState == .Play);
SetActiveScene(runtimeScene, startRuntime: (_sceneState == .Play), startSimulation: true, newPlayMode: (_sceneState == .Play ? .Play : .Simulation));
SetActiveScene(runtimeScene, startRuntime: (_sceneState == .Play), startSimulation: true, _sceneState);
if (_sceneState == .Play)
{
@@ -856,35 +856,26 @@ namespace GlitchyEditor
SwitchToPlayWindow();
}
enum PlayMode
{
Play,
Editor,
Simulation
}
/// Activates the given scene.
/// @param scene The scene to be activated.
/// @param startRuntime If set to true, the script runtime will be initialized for the given scene.
/// @param startSimulation If set to true, the physics simulation will be initialized for the given scene.
private void SetActiveScene(Scene scene, bool startRuntime, bool startSimulation, PlayMode? newPlayMode = null)
/// @param newSceneState The new scene state.
private void SetActiveScene(Scene scene, bool startRuntime, bool startSimulation, SceneState newSceneState)
{
_activeScene?.Stop();
if (newPlayMode != null)
{
switch (newPlayMode.Value)
switch (newSceneState)
{
case .Play:
ScriptEngine.ApplicationInfo.IsInPlayMode = true;
case .Editor:
case .Edit:
ScriptEngine.ApplicationInfo.IsInEditMode = true;
case .Simulation:
case .Simulate:
// No scripts in Simulation
ScriptEngine.ApplicationInfo.IsInEditMode = false;
ScriptEngine.ApplicationInfo.IsInPlayMode = false;
}
}
if (scene != null)
{
@@ -926,11 +917,11 @@ namespace GlitchyEditor
Log.EngineLogger.Trace("Stopping current scene and returing to edit mode...");
SetActiveScene(_editorScene, startRuntime: true, startSimulation: false, newPlayMode: .Editor);
_editor.SceneViewportWindow.EditorMode = true;
_sceneState = .Edit;
SetActiveScene(_editorScene, startRuntime: true, startSimulation: false, _sceneState);
_editor.CurrentScene = _activeScene;
_isPaused = false;