Added feedback on photography in diving game
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user