diff --git a/Assets/Scripts/Core/Settings/DivingMinigameSettings.cs b/Assets/Scripts/Core/Settings/DivingMinigameSettings.cs
index 2d19789d..58bd63ee 100644
--- a/Assets/Scripts/Core/Settings/DivingMinigameSettings.cs
+++ b/Assets/Scripts/Core/Settings/DivingMinigameSettings.cs
@@ -139,6 +139,10 @@ namespace AppleHills.Core.Settings
[Tooltip("Animation curve for the shrinking effect")]
[SerializeField] private AnimationCurve viewfinderShrinkCurve = AnimationCurve.EaseInOut(0, 1, 1, 0);
+ [Header("Photo Input")]
+ [Tooltip("Input mode for photo taking sequence")]
+ [SerializeField] private PhotoInputModes photoInputMode = PhotoInputModes.Tap;
+
[Tooltip("Padding factor to add space around the monster (1.0 = exact size, 1.2 = 20% extra)")]
[SerializeField] private float paddingFactor = 1.2f;
@@ -220,6 +224,7 @@ namespace AppleHills.Core.Settings
public float PaddingFactor => paddingFactor;
public float MaxSizePercent => maxSizePercent;
public float MinSizePercent => minSizePercent;
+ public PhotoInputModes PhotoInputMode => photoInputMode;
public override void OnValidate()
{
diff --git a/Assets/Scripts/Core/Settings/SettingsInterfaces.cs b/Assets/Scripts/Core/Settings/SettingsInterfaces.cs
index a2706dc6..f3a15a2f 100644
--- a/Assets/Scripts/Core/Settings/SettingsInterfaces.cs
+++ b/Assets/Scripts/Core/Settings/SettingsInterfaces.cs
@@ -3,6 +3,15 @@ using System.Collections.Generic;
namespace AppleHills.Core.Settings
{
+ ///
+ /// Enum defining the different input modes for photo taking
+ ///
+ public enum PhotoInputModes
+ {
+ Tap, // Original tap-based input
+ Hold // New hold-based input
+ }
+
///
/// Interface for player and follower settings
///
@@ -114,11 +123,12 @@ namespace AppleHills.Core.Settings
float ViewfinderShrinkDuration { get; }
float ViewfinderMoveSpeed { get; }
AnimationCurve ViewfinderShrinkCurve { get; }
- float ViewfinderStartScale { get; }
- float ViewfinderEndScale { get; }
float[] ViewfinderProgressThresholds { get; }
float PaddingFactor { get; }
float MaxSizePercent { get; }
float MinSizePercent { get; }
+
+ // Photo Input Settings
+ PhotoInputModes PhotoInputMode { get; }
}
}
diff --git a/Assets/Scripts/LevelS/LevelSwitch.cs b/Assets/Scripts/LevelS/LevelSwitch.cs
index 23df0ca7..2db71097 100644
--- a/Assets/Scripts/LevelS/LevelSwitch.cs
+++ b/Assets/Scripts/LevelS/LevelSwitch.cs
@@ -123,6 +123,7 @@ namespace LevelS
private void OnMenuCancel()
{
_isActive = true; // Allow interaction again if cancelled
+ InputManager.Instance.SetInputMode(InputMode.GameAndUI);
}
}
}
diff --git a/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs b/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs
index eed65640..57430c1e 100644
--- a/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs
+++ b/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs
@@ -294,6 +294,8 @@ namespace Minigames.DivingForPictures
private void SpawnMonster(Transform spawnPoint)
{
+ Debug.Log("Spawning monster: " + spawnPoint.name);
+
if (monsterPrefabs.Length == 0)
{
Debug.LogWarning("No monster prefabs assigned to DivingGameManager.");
diff --git a/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs b/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs
index 5e30a5ad..7b3b8784 100644
--- a/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs
+++ b/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs
@@ -29,6 +29,8 @@ namespace Minigames.DivingForPictures
private void Awake()
{
+ Debug.Log("Monster created: " + gameObject.name);
+
if (detectionCollider == null)
detectionCollider = GetComponent();
@@ -44,6 +46,11 @@ namespace Minigames.DivingForPictures
photoSequenceInProgress = false;
}
+ private void OnDestroy()
+ {
+ Debug.Log("Monster destroyed: " + gameObject.name);
+ }
+
private IEnumerator CheckIfOffScreen()
{
WaitForSeconds wait = new WaitForSeconds(0.5f);
@@ -72,15 +79,24 @@ namespace Minigames.DivingForPictures
Vector3 worldPosition = transform.position;
Vector3 viewportPoint = mainCamera.WorldToViewportPoint(worldPosition);
- // Adjust buffer to be larger below the screen to account for downward movement
- float bufferSides = 0.2f;
- float bufferTop = 0.2f;
- float bufferBottom = 0.5f; // Larger buffer below the screen
+ // If z is negative, the object is behind the camera
+ if (viewportPoint.z < 0)
+ return false;
- return viewportPoint.x > -bufferSides &&
- viewportPoint.x < 1 + bufferSides &&
- viewportPoint.y > -bufferBottom &&
- viewportPoint.y < 1 + bufferTop;
+ // Simple logic:
+ // 1. Allow monsters below the screen (new spawns)
+ // 2. Despawn monsters only when completely above the top of screen
+ // 3. Keep monsters that are on screen
+
+ // Check if the monster is above the top of the screen
+ if (viewportPoint.y > 1)
+ return false; // Monster is completely above screen, destroy it
+
+ // Check horizontal bounds (keep moderate buffer so monsters don't disappear at screen edges)
+ float bufferSides = 0.2f;
+ bool withinHorizontalBounds = viewportPoint.x > -bufferSides && viewportPoint.x < 1 + bufferSides;
+
+ return withinHorizontalBounds;
}
private void OnTriggerEnter2D(Collider2D other)
diff --git a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs
index 85973ef7..b4bd819c 100644
--- a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs
+++ b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs
@@ -57,6 +57,9 @@ namespace Minigames.DivingForPictures.PictureCamera
// Store settings
private IDivingMinigameSettings settings;
+
+ // New field to store the current input mode
+ private PhotoInputModes currentInputMode;
// Events for progress milestones
public event Action OnProgressUpdated; // Continuous progress updates (0-1)
@@ -89,6 +92,9 @@ namespace Minigames.DivingForPictures.PictureCamera
{
settings = GameManager.GetSettingsObject();
mainCamera = UnityEngine.Camera.main;
+
+ // Get the photo input mode from settings
+ currentInputMode = settings.PhotoInputMode;
}
///
@@ -135,7 +141,7 @@ namespace Minigames.DivingForPictures.PictureCamera
{
viewfinderComponent.Initialize(this);
viewfinderComponent.SetupInputOverride();
- viewfinderComponent.OnViewfinderTapped += HandleViewfinderTapped;
+ InitializeViewfinder(viewfinderComponent);
}
// Reset state
@@ -450,10 +456,13 @@ namespace Minigames.DivingForPictures.PictureCamera
{
if (viewfinderInstance != null)
{
- // Unsubscribe from the viewfinder's tap event
+ // Unsubscribe from all viewfinder events
if (viewfinderComponent != null)
{
viewfinderComponent.OnViewfinderTapped -= HandleViewfinderTapped;
+ viewfinderComponent.OnViewfinderTapped -= HandleViewfinderTappedDuringAnimation;
+ viewfinderComponent.OnViewfinderHoldStarted -= HandleViewfinderHoldStarted;
+ viewfinderComponent.OnViewfinderHoldEnded -= HandleViewfinderHoldEnded;
}
Destroy(viewfinderInstance);
@@ -507,8 +516,7 @@ namespace Minigames.DivingForPictures.PictureCamera
{
viewfinderComponent.Initialize(this);
viewfinderComponent.SetupInputOverride();
- viewfinderComponent.OnViewfinderTapped += HandleViewfinderTapped;
-
+ InitializeViewfinder(viewfinderComponent);
}
// Determine canvas width for full-screen sizing
@@ -583,6 +591,20 @@ namespace Minigames.DivingForPictures.PictureCamera
viewfinderComponent.OnViewfinderTapped += HandleViewfinderTappedDuringAnimation;
}
+ // Initialize viewfinder with appropriate event handlers based on input mode
+ if (viewfinderComponent != null)
+ {
+ viewfinderComponent.Initialize(this);
+ viewfinderComponent.SetupInputOverride();
+ InitializeViewfinder(viewfinderComponent);
+
+ // For animation sequence, we need additional handling for tapping during animation
+ if (currentInputMode == PhotoInputModes.Tap)
+ {
+ viewfinderComponent.OnViewfinderTapped += HandleViewfinderTappedDuringAnimation;
+ }
+ }
+
// Reset state
animationProgress = 0f;
isAnimating = true;
@@ -772,5 +794,80 @@ namespace Minigames.DivingForPictures.PictureCamera
HandleViewfinderTapped();
}
}
+
+ ///
+ /// Initialize the viewfinder with appropriate event handlers based on input mode
+ ///
+ /// The viewfinder component to initialize
+ public void InitializeViewfinder(Viewfinder viewfinder)
+ {
+ if (viewfinder != null)
+ {
+ // Clean up any existing event subscriptions
+ viewfinder.OnViewfinderTapped -= HandleViewfinderTapped;
+ viewfinder.OnViewfinderHoldStarted -= HandleViewfinderHoldStarted;
+ viewfinder.OnViewfinderHoldEnded -= HandleViewfinderHoldEnded;
+
+ // Set up handlers based on the current input mode
+ switch (currentInputMode)
+ {
+ case PhotoInputModes.Tap:
+ // For tap mode, only subscribe to tap events
+ viewfinder.OnViewfinderTapped += HandleViewfinderTapped;
+ break;
+
+ case PhotoInputModes.Hold:
+ // For hold mode, subscribe to hold start/end events
+ viewfinder.OnViewfinderHoldStarted += HandleViewfinderHoldStarted;
+ viewfinder.OnViewfinderHoldEnded += HandleViewfinderHoldEnded;
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Handles hold start event from the viewfinder
+ ///
+ private void HandleViewfinderHoldStarted()
+ {
+ if (currentInputMode == PhotoInputModes.Hold)
+ {
+ // Start the photo sequence when hold begins (same behavior as first tap in tap mode)
+ OnViewfinderTapped?.Invoke();
+ Debug.Log("[CameraViewfinderManager] Hold started - initiating photo sequence");
+ }
+ }
+
+ ///
+ /// Handles hold end event from the viewfinder
+ ///
+ private void HandleViewfinderHoldEnded()
+ {
+ if (currentInputMode == PhotoInputModes.Hold && isAnimating)
+ {
+ // Complete the sequence when hold ends (same behavior as second tap in tap mode)
+ OnViewfinderTappedDuringAnimation?.Invoke(currentProximity);
+ Debug.Log("[CameraViewfinderManager] Hold ended - completing photo sequence with proximity: " + currentProximity);
+
+ // Complete the animation immediately
+ if (animationCoroutine != null)
+ {
+ StopCoroutine(animationCoroutine);
+ animationCoroutine = null;
+ }
+
+ // Fire completed event
+ OnAnimationCompleted?.Invoke();
+ isAnimating = false;
+ isReversePhase = false;
+
+ // Hide the viewfinder
+ if (viewfinderComponent != null)
+ {
+ viewfinderComponent.RemoveInputOverride();
+ }
+ HideViewfinder();
+ }
+ }
}
}
diff --git a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs
index ca1d78b5..63e85c28 100644
--- a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs
+++ b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs
@@ -15,6 +15,8 @@ namespace Minigames.DivingForPictures.PictureCamera
// Events
public event System.Action OnViewfinderTapped;
+ public event System.Action OnViewfinderHoldStarted;
+ public event System.Action OnViewfinderHoldEnded;
// State
private bool isActive = true;
@@ -101,10 +103,30 @@ namespace Minigames.DivingForPictures.PictureCamera
}
}
- // Required interface methods (no-op implementations)
- public void OnHoldStart(Vector2 position) { }
- public void OnHoldMove(Vector2 position) { }
- public void OnHoldEnd(Vector2 position) { }
+ public void OnHoldStart(Vector2 position)
+ {
+ if (isActive)
+ {
+ // Fire the hold start event
+ OnViewfinderHoldStarted?.Invoke();
+ Debug.Log($"[MDPI] Viewfinder OnHoldStart: {position}");
+ }
+ }
+
+ public void OnHoldMove(Vector2 position)
+ {
+ // We can use this for any continuous effects during hold if needed in the future
+ }
+
+ public void OnHoldEnd(Vector2 position)
+ {
+ if (isActive)
+ {
+ // Fire the hold end event
+ OnViewfinderHoldEnded?.Invoke();
+ Debug.Log($"[MDPI] Viewfinder OnHoldEnd: {position}");
+ }
+ }
#endregion
diff --git a/Assets/Settings/DivingMinigameSettings.asset b/Assets/Settings/DivingMinigameSettings.asset
index ad29e189..58ff4efd 100644
--- a/Assets/Settings/DivingMinigameSettings.asset
+++ b/Assets/Settings/DivingMinigameSettings.asset
@@ -20,7 +20,7 @@ MonoBehaviour:
tapMaxDistance: 0.2
tapDecelerationRate: 15
baseSpawnProbability: 0.2
- maxSpawnProbability: 0.5
+ maxSpawnProbability: 0.8
probabilityIncreaseRate: 0.01
guaranteedSpawnTime: 30
spawnCooldown: 5
@@ -76,6 +76,7 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+ photoInputMode: 1
paddingFactor: 2
minSizePercent: 0.15
maxSizePercent: 1
@@ -85,4 +86,4 @@ MonoBehaviour:
- 0.25
- 0.5
- 0.75
- - 1
\ No newline at end of file
+ - 1