Pause timescale when game is paused
This commit is contained in:
@@ -123,8 +123,12 @@ namespace Core
|
||||
/// <param name="shouldPause">True to pause; false to resume</param>
|
||||
private void ApplyPause(bool shouldPause)
|
||||
{
|
||||
// TODO: Do we want to stop time?
|
||||
// Time.timeScale = shouldPause ? 0f : 1f;
|
||||
// Only affect timescale if debug setting allows it
|
||||
var debugSettings = GetDeveloperSettings<DebugSettings>();
|
||||
if (debugSettings != null && debugSettings.PauseTimeOnPauseGame)
|
||||
{
|
||||
Time.timeScale = shouldPause ? 0f : 1f;
|
||||
}
|
||||
|
||||
// Notify registered components
|
||||
foreach (var component in _pausableComponents)
|
||||
@@ -213,8 +217,9 @@ namespace Core
|
||||
|
||||
// Load developer settings
|
||||
var divingDevSettings = DeveloperSettingsProvider.Instance.GetSettings<DivingDeveloperSettings>();
|
||||
var debugSettings = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>();
|
||||
|
||||
_developerSettingsLoaded = divingDevSettings != null;
|
||||
_developerSettingsLoaded = divingDevSettings != null && debugSettings != null;
|
||||
|
||||
if (_developerSettingsLoaded)
|
||||
{
|
||||
|
||||
@@ -25,8 +25,13 @@ namespace AppleHills.Core.Settings
|
||||
[Tooltip("Should debug messages be show on screen in Editor")]
|
||||
[SerializeField] private bool showDebugUiMessages = false;
|
||||
|
||||
[Header("Game Behavior Options")]
|
||||
[Tooltip("Should Time.timeScale be set to 0 when the game is paused")]
|
||||
[SerializeField] private bool pauseTimeOnPauseGame = true;
|
||||
|
||||
// Property getters
|
||||
public bool ShowDebugUiMessages => showDebugUiMessages;
|
||||
public bool PauseTimeOnPauseGame => pauseTimeOnPauseGame;
|
||||
|
||||
public override void OnValidate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user