mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
Remove unnecessary PlayMode enum
This commit is contained in:
@@ -842,7 +842,7 @@ namespace GlitchyEditor
|
|||||||
// In simulation mode we don't want any scripts to run, just physics.
|
// In simulation mode we don't want any scripts to run, just physics.
|
||||||
_editorScene.CopyTo(runtimeScene, _sceneState == .Play);
|
_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)
|
if (_sceneState == .Play)
|
||||||
{
|
{
|
||||||
@@ -856,34 +856,25 @@ namespace GlitchyEditor
|
|||||||
SwitchToPlayWindow();
|
SwitchToPlayWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PlayMode
|
|
||||||
{
|
|
||||||
Play,
|
|
||||||
Editor,
|
|
||||||
Simulation
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Activates the given scene.
|
/// Activates the given scene.
|
||||||
/// @param scene The scene to be activated.
|
/// @param scene The scene to be activated.
|
||||||
/// @param startRuntime If set to true, the script runtime will be initialized for the given scene.
|
/// @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.
|
/// @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();
|
_activeScene?.Stop();
|
||||||
|
|
||||||
if (newPlayMode != null)
|
switch (newSceneState)
|
||||||
{
|
{
|
||||||
switch (newPlayMode.Value)
|
case .Play:
|
||||||
{
|
ScriptEngine.ApplicationInfo.IsInPlayMode = true;
|
||||||
case .Play:
|
case .Edit:
|
||||||
ScriptEngine.ApplicationInfo.IsInPlayMode = true;
|
ScriptEngine.ApplicationInfo.IsInEditMode = true;
|
||||||
case .Editor:
|
case .Simulate:
|
||||||
ScriptEngine.ApplicationInfo.IsInEditMode = true;
|
// No scripts in Simulation
|
||||||
case .Simulation:
|
ScriptEngine.ApplicationInfo.IsInEditMode = false;
|
||||||
// No scripts in Simulation
|
ScriptEngine.ApplicationInfo.IsInPlayMode = false;
|
||||||
ScriptEngine.ApplicationInfo.IsInEditMode = false;
|
|
||||||
ScriptEngine.ApplicationInfo.IsInPlayMode = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene != null)
|
if (scene != null)
|
||||||
@@ -925,12 +916,12 @@ namespace GlitchyEditor
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Log.EngineLogger.Trace("Stopping current scene and returing to edit mode...");
|
Log.EngineLogger.Trace("Stopping current scene and returing to edit mode...");
|
||||||
|
|
||||||
SetActiveScene(_editorScene, startRuntime: true, startSimulation: false, newPlayMode: .Editor);
|
|
||||||
|
|
||||||
_editor.SceneViewportWindow.EditorMode = true;
|
_editor.SceneViewportWindow.EditorMode = true;
|
||||||
_sceneState = .Edit;
|
_sceneState = .Edit;
|
||||||
|
|
||||||
|
SetActiveScene(_editorScene, startRuntime: true, startSimulation: false, _sceneState);
|
||||||
|
|
||||||
_editor.CurrentScene = _activeScene;
|
_editor.CurrentScene = _activeScene;
|
||||||
|
|
||||||
_isPaused = false;
|
_isPaused = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user