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

@@ -343,16 +343,16 @@ LineRenderer:
m_SortingOrder: 0 m_SortingOrder: 0
m_Positions: m_Positions:
- {x: -0.15602553, y: 4.074945, z: 0} - {x: -0.15602553, y: 4.074945, z: 0}
- {x: -0.1566351, y: 3.973638, z: 0} - {x: -0.1566351, y: 3.9736383, z: 0}
- {x: -0.1572447, y: 3.8729856, z: 0} - {x: -0.1572447, y: 3.8729858, z: 0}
- {x: -0.15785426, y: 3.7729874, z: 0} - {x: -0.15785426, y: 3.7729874, z: 0}
- {x: -0.15846384, y: 3.6736436, z: 0} - {x: -0.15846384, y: 3.673644, z: 0}
- {x: -0.15907341, y: 3.574954, z: 0} - {x: -0.15907341, y: 3.5749543, z: 0}
- {x: -0.15968299, y: 3.4769192, z: 0} - {x: -0.15968299, y: 3.4769197, z: 0}
- {x: -0.16029257, y: 3.3795385, z: 0} - {x: -0.16029257, y: 3.3795385, z: 0}
- {x: -0.16090216, y: 3.2828126, z: 0} - {x: -0.16090216, y: 3.2828126, z: 0}
- {x: -0.16151173, y: 3.1867409, z: 0} - {x: -0.16151173, y: 3.1867406, z: 0}
- {x: -0.16212131, y: 3.0913236, z: 0} - {x: -0.16212131, y: 3.0913231, z: 0}
m_Parameters: m_Parameters:
serializedVersion: 3 serializedVersion: 3
widthMultiplier: 1 widthMultiplier: 1
@@ -749,6 +749,7 @@ GameObject:
- component: {fileID: 424805726} - component: {fileID: 424805726}
- component: {fileID: 424805725} - component: {fileID: 424805725}
- component: {fileID: 424805727} - component: {fileID: 424805727}
- component: {fileID: 424805728}
m_Layer: 0 m_Layer: 0
m_Name: MinigameManagers m_Name: MinigameManagers
m_TagString: Untagged m_TagString: Untagged
@@ -779,7 +780,9 @@ MonoBehaviour:
- {fileID: 173052728} - {fileID: 173052728}
surfacingTimeline: {fileID: 2064311130} surfacingTimeline: {fileID: 2064311130}
flashRef: {fileID: 1419181041} flashRef: {fileID: 1419181041}
viewfinderManager: {fileID: 0}
deathAudioPlayer: {fileID: 199536377} deathAudioPlayer: {fileID: 199536377}
cameraViewfinderManager: {fileID: 424805727}
--- !u!4 &424805726 --- !u!4 &424805726
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -808,6 +811,105 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Minigames.DivingForPictures.PictureCamera.CameraViewfinderManager m_EditorClassIdentifier: AppleHillsScripts::Minigames.DivingForPictures.PictureCamera.CameraViewfinderManager
targetCanvas: {fileID: 116234200} targetCanvas: {fileID: 116234200}
flashSound: {fileID: 8300000, guid: 2ac461fcc3f7a014ca716a4f231be004, type: 3}
focusSound: {fileID: 8300000, guid: 33589e2f20465f740be4b73838f795b1, type: 3}
--- !u!82 &424805728
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 424805724}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 1171626333864818265, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 8300000, guid: 33589e2f20465f740be4b73838f795b1, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &461301695 --- !u!1 &461301695
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1601,14 +1703,14 @@ LineRenderer:
- {x: -0.15602553, y: 4.0749445, z: 0} - {x: -0.15602553, y: 4.0749445, z: 0}
- {x: -0.11662118, y: 3.879622, z: 0} - {x: -0.11662118, y: 3.879622, z: 0}
- {x: -0.07721684, y: 3.7057445, z: 0} - {x: -0.07721684, y: 3.7057445, z: 0}
- {x: -0.03781248, y: 3.5533106, z: 0} - {x: -0.03781248, y: 3.5533104, z: 0}
- {x: 0.0015918687, y: 3.4223216, z: 0} - {x: 0.0015918687, y: 3.4223213, z: 0}
- {x: 0.040996216, y: 3.3127766, z: 0} - {x: 0.040996216, y: 3.312776, z: 0}
- {x: 0.08040057, y: 3.2246761, z: 0} - {x: 0.08040057, y: 3.2246757, z: 0}
- {x: 0.11980491, y: 3.15802, z: 0} - {x: 0.11980491, y: 3.1580195, z: 0}
- {x: 0.15920927, y: 3.1128082, z: 0} - {x: 0.15920927, y: 3.1128078, z: 0}
- {x: 0.1986136, y: 3.0890405, z: 0} - {x: 0.1986136, y: 3.0890403, z: 0}
- {x: 0.23801796, y: 3.0867176, z: 0} - {x: 0.23801796, y: 3.0867171, z: 0}
m_Parameters: m_Parameters:
serializedVersion: 3 serializedVersion: 3
widthMultiplier: 1 widthMultiplier: 1
@@ -2450,14 +2552,14 @@ LineRenderer:
- {x: -0.15602553, y: 4.0749445, z: 0} - {x: -0.15602553, y: 4.0749445, z: 0}
- {x: -0.18956745, y: 3.8764973, z: 0} - {x: -0.18956745, y: 3.8764973, z: 0}
- {x: -0.22310936, y: 3.7000232, z: 0} - {x: -0.22310936, y: 3.7000232, z: 0}
- {x: -0.25665125, y: 3.5455203, z: 0} - {x: -0.25665125, y: 3.54552, z: 0}
- {x: -0.29019317, y: 3.412991, z: 0} - {x: -0.29019317, y: 3.4129906, z: 0}
- {x: -0.32373506, y: 3.3024335, z: 0} - {x: -0.32373506, y: 3.302433, z: 0}
- {x: -0.35727698, y: 3.2138484, z: 0} - {x: -0.35727698, y: 3.213848, z: 0}
- {x: -0.39081886, y: 3.1472359, z: 0} - {x: -0.39081886, y: 3.1472354, z: 0}
- {x: -0.4243608, y: 3.1025958, z: 0} - {x: -0.4243608, y: 3.1025953, z: 0}
- {x: -0.45790267, y: 3.0799282, z: 0} - {x: -0.45790267, y: 3.0799277, z: 0}
- {x: -0.4914446, y: 3.079233, z: 0} - {x: -0.4914446, y: 3.0792325, z: 0}
m_Parameters: m_Parameters:
serializedVersion: 3 serializedVersion: 3
widthMultiplier: 1 widthMultiplier: 1
@@ -3230,7 +3332,7 @@ Transform:
m_GameObject: {fileID: 2106431001} m_GameObject: {fileID: 2106431001}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.165, y: 2.6975174, z: 0} m_LocalPosition: {x: -0.165, y: 2.697517, z: 0}
m_LocalScale: {x: 0.57574, y: 0.57574, z: 0.57574} m_LocalScale: {x: 0.57574, y: 0.57574, z: 0.57574}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:

View File

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

View File

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

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 33589e2f20465f740be4b73838f795b1
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant: