Added feedback on photography in diving game

This commit is contained in:
journaliciouz
2025-10-20 23:18:31 +02:00
parent 84dd8004d5
commit d1792014db
5 changed files with 173 additions and 26 deletions

View File

@@ -35,7 +35,7 @@ namespace Minigames.DivingForPictures
[SerializeField] private GameObject flashRef;
private CameraViewfinderManager viewfinderManager;
public CameraViewfinderManager viewfinderManager;
// Settings reference
private IDivingMinigameSettings settings;
@@ -107,7 +107,7 @@ namespace Minigames.DivingForPictures
private static bool _isQuitting = false;
public AudioSource deathAudioPlayer;
public CameraViewfinderManager cameraViewfinderManager;
public static DivingGameManager Instance => _instance;
@@ -886,6 +886,7 @@ namespace Minigames.DivingForPictures
{
flash.TriggerFlash();
cameraViewfinderManager.PlayShutterSound();
}
}

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections;
using AppleHills.Core.Settings;
using Core;
using UnityEngine.Audio;
namespace Minigames.DivingForPictures.PictureCamera
{
@@ -42,6 +43,7 @@ namespace Minigames.DivingForPictures.PictureCamera
private RectTransform viewfinderRectTransform;
private Viewfinder viewfinderComponent;
private UnityEngine.Camera mainCamera;
private AudioSource _audioSource;
// Animation state
private float animationProgress = 0f;
@@ -62,6 +64,9 @@ namespace Minigames.DivingForPictures.PictureCamera
// New field to store the current input mode
private PhotoInputModes currentInputMode;
public AudioResource flashSound;
public AudioResource focusSound;
// Events for progress milestones
public event Action<float> OnProgressUpdated; // Continuous progress updates (0-1)
public event Action OnAnimationStarted;
@@ -93,6 +98,7 @@ namespace Minigames.DivingForPictures.PictureCamera
{
settings = GameManager.GetSettingsObject<IDivingMinigameSettings>();
mainCamera = UnityEngine.Camera.main;
_audioSource = GetComponent<AudioSource>();
// Get the photo input mode from settings
currentInputMode = settings.PhotoInputMode;
@@ -562,6 +568,7 @@ namespace Minigames.DivingForPictures.PictureCamera
targetTransform = target;
isReversePhase = false;
currentProximity = 0f;
PlayFocusSound();
// Calculate target screen position and size based on monster's sprite bounds
CalculateTargetScreenPositionAndSize();
@@ -865,5 +872,19 @@ namespace Minigames.DivingForPictures.PictureCamera
HideViewfinder();
}
}
public void PlayShutterSound()
{
_audioSource.Stop();
_audioSource.resource = flashSound;
_audioSource.Play();
}
private void PlayFocusSound()
{
_audioSource.Stop();
_audioSource.resource = focusSound;
_audioSource.Play();
}
}
}