Pause timescale when game is paused
This commit is contained in:
@@ -62,19 +62,28 @@ public class SceneBrowserWindow : EditorWindow
|
||||
if (GUILayout.Button("Refresh"))
|
||||
RefreshScenes();
|
||||
_scroll = EditorGUILayout.BeginScrollView(_scroll);
|
||||
|
||||
// Create a safe copy to avoid collection modification during enumeration
|
||||
var foldersCopy = _scenesByFolder.Keys.ToList();
|
||||
|
||||
// Top-level scenes
|
||||
if (_scenesByFolder.ContainsKey(""))
|
||||
if (foldersCopy.Contains("") && _scenesByFolder.ContainsKey(""))
|
||||
{
|
||||
foreach (var scene in _scenesByFolder[""])
|
||||
var topLevelScenes = _scenesByFolder[""].ToList();
|
||||
foreach (var scene in topLevelScenes)
|
||||
DrawSceneRow(scene);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
// Subfolders
|
||||
foreach (var kvp in _scenesByFolder)
|
||||
foreach (var folderKey in foldersCopy)
|
||||
{
|
||||
if (string.IsNullOrEmpty(kvp.Key)) continue;
|
||||
EditorGUILayout.LabelField(kvp.Key, EditorStyles.boldLabel);
|
||||
foreach (var scene in kvp.Value)
|
||||
if (string.IsNullOrEmpty(folderKey)) continue;
|
||||
if (!_scenesByFolder.ContainsKey(folderKey)) continue;
|
||||
|
||||
EditorGUILayout.LabelField(folderKey, EditorStyles.boldLabel);
|
||||
var scenesInFolder = _scenesByFolder[folderKey].ToList();
|
||||
foreach (var scene in scenesInFolder)
|
||||
DrawSceneRow(scene);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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()
|
||||
{
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace UI.CardSystem
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
canvasGroup.alpha = 0f;
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -288,7 +288,7 @@ namespace UI.CardSystem
|
||||
// Simple fade out animation
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -177,7 +177,8 @@ namespace UI.CardSystem
|
||||
pulseDuration/2,
|
||||
0,
|
||||
Tween.EaseIn);
|
||||
});
|
||||
},
|
||||
obeyTimescale: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace UI.CardSystem
|
||||
// Animate the booster pack opening
|
||||
Tween.LocalScale(boosterPackObject.transform, Vector3.zero, 0.3f, 0f, Tween.EaseInBack, Tween.LoopType.None, null, () => {
|
||||
boosterPackObject.SetActive(false);
|
||||
});
|
||||
}, obeyTimescale: false);
|
||||
}
|
||||
|
||||
if (openBoosterButton != null)
|
||||
@@ -322,7 +322,7 @@ namespace UI.CardSystem
|
||||
Debug.Log($"[BoosterOpeningPage] Card back {i} activated");
|
||||
|
||||
// Play reveal animation using Pixelplacement.Tween
|
||||
Tween.LocalScale(cardBackObj.transform, Vector3.one, 0.5f, 0f, Tween.EaseOutBack);
|
||||
Tween.LocalScale(cardBackObj.transform, Vector3.one, 0.5f, 0f, Tween.EaseOutBack, obeyTimescale: false);
|
||||
|
||||
// Wait for animation delay
|
||||
yield return new WaitForSeconds(cardRevealDelay);
|
||||
@@ -374,7 +374,7 @@ namespace UI.CardSystem
|
||||
Transform cardBackTransform = cardBack.transform;
|
||||
|
||||
// Step 1: Flip the card 90 degrees (showing the edge)
|
||||
Tween.LocalRotation(cardBackTransform, new Vector3(0, 90, 0), flipAnimationDuration * 0.5f, 0);
|
||||
Tween.LocalRotation(cardBackTransform, new Vector3(0, 90, 0), flipAnimationDuration * 0.5f, 0, obeyTimescale: false);
|
||||
|
||||
// Wait for half the flip duration
|
||||
yield return new WaitForSeconds(flipAnimationDuration * 0.5f);
|
||||
@@ -405,7 +405,7 @@ namespace UI.CardSystem
|
||||
}
|
||||
|
||||
// Step 3: Finish the flip animation (from 90 degrees to 0)
|
||||
Tween.LocalRotation(cardObj.transform, Vector3.zero, flipAnimationDuration * 0.5f, 0);
|
||||
Tween.LocalRotation(cardObj.transform, Vector3.zero, flipAnimationDuration * 0.5f, 0, obeyTimescale: false);
|
||||
|
||||
// Increment counter of revealed cards
|
||||
_revealedCardCount++;
|
||||
@@ -441,8 +441,8 @@ namespace UI.CardSystem
|
||||
Vector3 originalScale = cardTransform.localScale;
|
||||
|
||||
// Sequence: Scale up slightly, then back to normal
|
||||
Tween.LocalScale(cardTransform, originalScale * 1.2f, 0.2f, 0.1f, Tween.EaseOutBack);
|
||||
Tween.LocalScale(cardTransform, originalScale, 0.15f, 0.3f, Tween.EaseIn);
|
||||
Tween.LocalScale(cardTransform, originalScale * 1.2f, 0.2f, 0.1f, Tween.EaseOutBack, obeyTimescale: false);
|
||||
Tween.LocalScale(cardTransform, originalScale, 0.15f, 0.3f, Tween.EaseIn, obeyTimescale: false);
|
||||
|
||||
// Play sound effect based on rarity (if available)
|
||||
// This would require audio source components to be set up
|
||||
@@ -463,7 +463,7 @@ namespace UI.CardSystem
|
||||
continueButton.gameObject.SetActive(true);
|
||||
continueButton.transform.localScale = Vector3.zero;
|
||||
|
||||
Tween.LocalScale(continueButton.transform, Vector3.one, 0.3f, 0f, Tween.EaseOutBack);
|
||||
Tween.LocalScale(continueButton.transform, Vector3.one, 0.3f, 0f, Tween.EaseOutBack, obeyTimescale: false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,8 +542,8 @@ namespace UI.CardSystem
|
||||
Vector3 targetPos = card.transform.parent.InverseTransformPoint(backpackWorldPos);
|
||||
|
||||
// Start the move animation - ensure no cancellation between animations
|
||||
Tween.LocalPosition(card.transform, targetPos, animationDuration, cardDelay * i, Tween.EaseInOut);
|
||||
Tween.LocalScale(card.transform, Vector3.zero, animationDuration, cardDelay * i, Tween.EaseIn);
|
||||
Tween.LocalPosition(card.transform, targetPos, animationDuration, cardDelay * i, Tween.EaseInOut, obeyTimescale: false);
|
||||
Tween.LocalScale(card.transform, Vector3.zero, animationDuration, cardDelay * i, Tween.EaseIn, obeyTimescale: false);
|
||||
|
||||
Debug.Log($"[BoosterOpeningPage] Starting animation for card {i}");
|
||||
}
|
||||
@@ -578,7 +578,7 @@ namespace UI.CardSystem
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
canvasGroup.alpha = 0f;
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -595,7 +595,7 @@ namespace UI.CardSystem
|
||||
// Simple fade out animation
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace UI.CardSystem
|
||||
|
||||
// Animate the notification dot for feedback
|
||||
boosterNotificationDot.transform.localScale = Vector3.one * 1.2f;
|
||||
Tween.LocalScale(boosterNotificationDot.transform, Vector3.one, 0.3f, 0f);
|
||||
Tween.LocalScale(boosterNotificationDot.transform, Vector3.one, 0.3f, 0f, obeyTimescale: false);
|
||||
|
||||
// Update visibility based on count
|
||||
UpdateBoosterVisibility();
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace UI.CardSystem
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
canvasGroup.alpha = 0f;
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -192,7 +192,7 @@ namespace UI.CardSystem
|
||||
// Simple fade out animation
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete);
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -13,3 +13,4 @@ MonoBehaviour:
|
||||
m_Name: DebugSettings
|
||||
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.Core.Settings.DebugSettings
|
||||
showDebugUiMessages: 1
|
||||
pauseTimeOnPauseGame: 1
|
||||
|
||||
Reference in New Issue
Block a user