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

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

View File

@@ -98,24 +98,10 @@ namespace Minigames.DivingForPictures
public event Action<Monster, float> OnPhotoSequenceCompleted; // Now includes proximity score
public event Action<float> OnPhotoSequenceProgressUpdated;
private static DivingGameManager _instance;
private static DivingGameManager _instance = null;
private static bool _isQuitting = false;
public static DivingGameManager 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;
}
}
public static DivingGameManager Instance => _instance;
private void Awake()
{

View File

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

View File

@@ -82,17 +82,13 @@ namespace Minigames.DivingForPictures
if (onObstacleDestroyed == null)
onObstacleDestroyed = new UnityEvent<GameObject>();
}
void OnEnable()
{
// Register with the DivingGameManager for pause/resume events
DivingGameManager.Instance.RegisterPausableComponent(this);
}
private void Start()
{
// Register with the DivingGameManager for pause/resume events
DivingGameManager.Instance.RegisterPausableComponent(this);
DivingGameManager.Instance.OnGameInitialized += Initialize;
// If game is already initialized, initialize immediately
if (DivingGameManager.Instance.GetType().GetField("_isGameInitialized",
System.Reflection.BindingFlags.NonPublic |
@@ -104,7 +100,7 @@ namespace Minigames.DivingForPictures
private void OnDestroy()
{
DivingGameManager.Instance.UnregisterPausableComponent(this);
DivingGameManager.Instance?.UnregisterPausableComponent(this);
// Clean up any active coroutines
StopAllCoroutines();

View File

@@ -42,15 +42,12 @@ namespace Minigames.DivingForPictures.Player
Debug.LogError("[PlayerController] Failed to load diving minigame settings!");
}
}
void OnEnable()
{
// Register as a pausable component with DivingGameManager
DivingGameManager.Instance.RegisterPausableComponent(this);
}
void Start()
{
// Register as a pausable component with DivingGameManager
DivingGameManager.Instance.RegisterPausableComponent(this);
// Initialize target to current position
targetFingerX = transform.position.x;
isTouchActive = false;
@@ -114,10 +111,11 @@ namespace Minigames.DivingForPictures.Player
private void OnDestroy()
{
DivingGameManager.Instance.OnGameInitialized -= Initialize;
// Unregister as a pausable component
DivingGameManager.Instance.UnregisterPausableComponent(this);
if (DivingGameManager.Instance)
{
DivingGameManager.Instance.OnGameInitialized -= Initialize;
DivingGameManager.Instance.UnregisterPausableComponent(this);
}
// Unsubscribe from edge anchor events
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
DivingGameManager.Instance.RegisterPausableComponent(this);
}
private void Start()
{
DivingGameManager.Instance.OnGameInitialized += Initialize;
// If game is already initialized, initialize immediately
@@ -189,7 +185,7 @@ namespace Minigames.DivingForPictures
private void OnDestroy()
{
DivingGameManager.Instance.UnregisterPausableComponent(this);
DivingGameManager.Instance?.UnregisterPausableComponent(this);
}
/// <summary>

View File

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

View File

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

View File

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

View File

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