Compare commits

...

3 Commits

Author SHA1 Message Date
bb6059a885 Merge branch 'audio' 2025-10-17 13:44:33 +02:00
Michal Pikulski
74339d7c47 Fix pausing etc. issues in the minigame 2025-10-17 13:18:49 +02:00
78fad26ff5 Apple Hills Font 2025-10-17 13:04:15 +02:00
19 changed files with 121 additions and 60 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c4d9cb72b0216fb47ba3efd865e7ba61
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 0308f8a42572b354e820e31ec96b177c
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Trafalgar_2
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 6d65e7e8f5789654f852ad213fda2393
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Trafalgar_3
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 695b6b4991951e74db42310b26cf490e
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Trafalgar_4
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 09a5e2ee29c2fa4468d79f36b7b725f6
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Trafalgar_NEW
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -67,20 +67,16 @@ namespace Minigames.DivingForPictures
SetNextSpawnInterval(); SetNextSpawnInterval();
} }
private void OnEnable()
{
DivingGameManager.Instance.RegisterPausableComponent(this);
}
void Start() void Start()
{ {
// Start spawning if not paused // Start spawning if not paused
DivingGameManager.Instance.RegisterPausableComponent(this);
StartSpawningCoroutine(); StartSpawningCoroutine();
} }
void OnDestroy() void OnDestroy()
{ {
DivingGameManager.Instance.UnregisterPausableComponent(this); DivingGameManager.Instance?.UnregisterPausableComponent(this);
// Clean up any active coroutines // Clean up any active coroutines
StopAllCoroutines(); StopAllCoroutines();

View File

@@ -98,24 +98,10 @@ namespace Minigames.DivingForPictures
public event Action<Monster, float> OnPhotoSequenceCompleted; // Now includes proximity score public event Action<Monster, float> OnPhotoSequenceCompleted; // Now includes proximity score
public event Action<float> OnPhotoSequenceProgressUpdated; public event Action<float> OnPhotoSequenceProgressUpdated;
private static DivingGameManager _instance; private static DivingGameManager _instance = null;
private static bool _isQuitting = false; private static bool _isQuitting = false;
public static DivingGameManager Instance
{ public static DivingGameManager Instance => _instance;
get
{
if (_instance == null && Application.isPlaying && !_isQuitting)
{
_instance = FindAnyObjectByType<DivingGameManager>();
if (_instance == null)
{
var go = new GameObject("DivingGameManager");
_instance = go.AddComponent<DivingGameManager>();
}
}
return _instance;
}
}
private void Awake() private void Awake()
{ {

View File

@@ -29,9 +29,12 @@ namespace Minigames.DivingForPictures
private void OnDestroy() private void OnDestroy()
{ {
// Unsubscribe from events // Unsubscribe from events
if (DivingGameManager.Instance)
{
DivingGameManager.Instance.OnScoreChanged -= UpdateScoreDisplay; DivingGameManager.Instance.OnScoreChanged -= UpdateScoreDisplay;
DivingGameManager.Instance.OnPictureTaken -= ShowScorePopup; DivingGameManager.Instance.OnPictureTaken -= ShowScorePopup;
} }
}
private void UpdateScoreDisplay(int score) private void UpdateScoreDisplay(int score)
{ {

View File

@@ -83,14 +83,10 @@ namespace Minigames.DivingForPictures
onObstacleDestroyed = new UnityEvent<GameObject>(); onObstacleDestroyed = new UnityEvent<GameObject>();
} }
void OnEnable() private void Start()
{ {
// Register with the DivingGameManager for pause/resume events // Register with the DivingGameManager for pause/resume events
DivingGameManager.Instance.RegisterPausableComponent(this); DivingGameManager.Instance.RegisterPausableComponent(this);
}
private void Start()
{
DivingGameManager.Instance.OnGameInitialized += Initialize; DivingGameManager.Instance.OnGameInitialized += Initialize;
// If game is already initialized, initialize immediately // If game is already initialized, initialize immediately
@@ -104,7 +100,7 @@ namespace Minigames.DivingForPictures
private void OnDestroy() private void OnDestroy()
{ {
DivingGameManager.Instance.UnregisterPausableComponent(this); DivingGameManager.Instance?.UnregisterPausableComponent(this);
// Clean up any active coroutines // Clean up any active coroutines
StopAllCoroutines(); StopAllCoroutines();

View File

@@ -43,14 +43,11 @@ namespace Minigames.DivingForPictures.Player
} }
} }
void OnEnable() void Start()
{ {
// Register as a pausable component with DivingGameManager // Register as a pausable component with DivingGameManager
DivingGameManager.Instance.RegisterPausableComponent(this); DivingGameManager.Instance.RegisterPausableComponent(this);
}
void Start()
{
// Initialize target to current position // Initialize target to current position
targetFingerX = transform.position.x; targetFingerX = transform.position.x;
isTouchActive = false; isTouchActive = false;
@@ -113,11 +110,12 @@ namespace Minigames.DivingForPictures.Player
} }
private void OnDestroy() private void OnDestroy()
{
if (DivingGameManager.Instance)
{ {
DivingGameManager.Instance.OnGameInitialized -= Initialize; DivingGameManager.Instance.OnGameInitialized -= Initialize;
// Unregister as a pausable component
DivingGameManager.Instance.UnregisterPausableComponent(this); DivingGameManager.Instance.UnregisterPausableComponent(this);
}
// Unsubscribe from edge anchor events // Unsubscribe from edge anchor events
if (edgeAnchor != null) if (edgeAnchor != null)

View File

@@ -168,14 +168,10 @@ namespace Minigames.DivingForPictures
} }
} }
private void OnEnable() private void Start()
{ {
// Register with the DivingGameManager for pause/resume events // Register with the DivingGameManager for pause/resume events
DivingGameManager.Instance.RegisterPausableComponent(this); DivingGameManager.Instance.RegisterPausableComponent(this);
}
private void Start()
{
DivingGameManager.Instance.OnGameInitialized += Initialize; DivingGameManager.Instance.OnGameInitialized += Initialize;
// If game is already initialized, initialize immediately // If game is already initialized, initialize immediately
@@ -189,7 +185,7 @@ namespace Minigames.DivingForPictures
private void OnDestroy() private void OnDestroy()
{ {
DivingGameManager.Instance.UnregisterPausableComponent(this); DivingGameManager.Instance?.UnregisterPausableComponent(this);
} }
/// <summary> /// <summary>

View File

@@ -9,7 +9,7 @@ namespace Minigames.DivingForPictures.Utilities
private bool isPaused = false; private bool isPaused = false;
private void OnEnable() private void Start()
{ {
DivingGameManager.Instance.RegisterPausableComponent(this); DivingGameManager.Instance.RegisterPausableComponent(this);
} }

View File

@@ -10,7 +10,7 @@ namespace Minigames.DivingForPictures.Utilities
private bool isPaused = false; private bool isPaused = false;
private void OnEnable() private void Start()
{ {
DivingGameManager.Instance.RegisterPausableComponent(this); DivingGameManager.Instance.RegisterPausableComponent(this);
} }

View File

@@ -9,12 +9,6 @@ public class DivingGameOverScreen : MonoBehaviour
[SerializeField] [SerializeField]
private TextMeshProUGUI finalScoreText; private TextMeshProUGUI finalScoreText;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
void OnEnable() void OnEnable()
{ {
if (DivingGameManager.Instance != null) if (DivingGameManager.Instance != null)

View File

@@ -26,9 +26,9 @@ MonoBehaviour:
spawnCooldown: 5 spawnCooldown: 5
basePoints: 100 basePoints: 100
depthMultiplier: 10 depthMultiplier: 10
speedTransitionDuration: 2 speedTransitionDuration: 3
surfacingSpeedFactor: 6 surfacingSpeedFactor: 6
surfacingSpawnDelay: 5 surfacingSpawnDelay: 2
referenceScreenHeight: 1920 referenceScreenHeight: 1920
initialTileCount: 3 initialTileCount: 3
tileSpawnBuffer: 2 tileSpawnBuffer: 2