Gardener audio refactor

This commit is contained in:
journaliciouz
2025-10-30 15:25:07 +01:00
parent e81879959e
commit 2b41a9f200
6 changed files with 213 additions and 2166 deletions

View File

@@ -134,12 +134,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f0f1834ce0c7b0b42b633a6d2bd67698, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
gardenerAudioPlayer: {fileID: 2263287369158035129}
mowerAudioPlayer: {fileID: 647208781616539222}
gardenerAudioPlayer: {fileID: 0}
mowerAudioPlayer: {fileID: 0}
mowerStartAudio: {fileID: 8300000, guid: 082fcd5bdadf2884e9aefc6abf4a5cc5, type: 3}
mowerLoopAudio: {fileID: 8300000, guid: aed79daa951bce74196ce04da2990b22, type: 3}
mowerLoopAudio: {fileID: 0}
gardenerFleeAudioClip: {fileID: 6418180475301049370, guid: 4949348ce86bb9e43a4251c06c1cb5d1, type: 2}
gardenerChaseAudioClip: {fileID: 6418180475301049370, guid: 97ccaa2fcf396f446aa7fde8586d225a, type: 2}
gardenerSprite: {fileID: 0}
--- !u!1 &1251257928845417300
GameObject:
m_ObjectHideFlags: 0
@@ -308,7 +309,6 @@ Transform:
- {fileID: 5409891338185859165}
- {fileID: 3150182414053579701}
- {fileID: 1667791532132169314}
- {fileID: 3539173003033760347}
m_Father: {fileID: 2264394306674147778}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &20943836391379072
@@ -907,135 +907,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5980d28f81eb545d78e1d84e1449a10f, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &8590192324315186055
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3539173003033760347}
- component: {fileID: 647208781616539222}
m_Layer: 0
m_Name: MowerSFX
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3539173003033760347
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8590192324315186055}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -2.5896003, y: -4.9567494, z: 0}
m_LocalScale: {x: 0.7142856, y: 0.7142856, z: 0.7142856}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8242272023601642381}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &647208781616539222
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8590192324315186055}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 1171626333864818265, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 20
MaxDistance: 50.5
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: 1
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 &9197792684223820912
GameObject:
m_ObjectHideFlags: 0
@@ -1171,11 +1042,11 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 1592061707390547073, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}
propertyPath: m_LocalPosition.x
value: -0.22846493
value: -0.22846495
objectReference: {fileID: 0}
- target: {fileID: 1592061707390547073, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}
propertyPath: m_LocalPosition.y
value: -3.3647113
value: -3.3647115
objectReference: {fileID: 0}
- target: {fileID: 1592061707390547073, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}
propertyPath: m_LocalPosition.z
@@ -1232,9 +1103,6 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 5034469437909578894, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}
insertIndex: -1
addedObject: {fileID: 7341880855800055810}
- targetCorrespondingSourceObject: {fileID: 5034469437909578894, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}
insertIndex: -1
addedObject: {fileID: 2263287369158035129}
m_SourcePrefab: {fileID: 100100000, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}
--- !u!1 &1789599716509294674 stripped
GameObject:
@@ -1253,103 +1121,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: eaefd3d5a2a864ca5b5d9ec5f2a7040f, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!82 &2263287369158035129
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1789599716509294674}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 3533147658878909314, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 20
MaxDistance: 50
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: 1
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!4 &5409891338185859165 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1592061707390547073, guid: 7be57ba4ecd292f4c90169045a2d69e4, type: 3}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -932,7 +932,7 @@ MonoBehaviour:
audioSourceType: 0
audioSource: {fileID: 0}
clipPriority: 0
sourcePriority: 0
sourcePriority: 1
--- !u!1001 &28205340
PrefabInstance:
m_ObjectHideFlags: 0
@@ -445950,6 +445950,7 @@ GameObject:
m_Component:
- component: {fileID: 872605980}
- component: {fileID: 872605979}
- component: {fileID: 872605981}
m_Layer: 0
m_Name: MowerSFX
m_TagString: Untagged
@@ -446078,6 +446079,22 @@ Transform:
m_Children: []
m_Father: {fileID: 1481757350}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &872605981
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 872605978}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
audioSourceType: 3
audioSource: {fileID: 0}
clipPriority: 0
sourcePriority: 0
--- !u!1 &874984580
GameObject:
m_ObjectHideFlags: 0
@@ -451692,11 +451709,11 @@ PrefabInstance:
- target: {fileID: 6510906053583315767, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: mowerAudioPlayer
value:
objectReference: {fileID: 872605979}
objectReference: {fileID: 872605981}
- target: {fileID: 6510906053583315767, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: gardenerAudioPlayer
value:
objectReference: {fileID: 1682591190}
objectReference: {fileID: 21238932}
- target: {fileID: 6510906053583315767, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: gardenerFleeAudioClip
value:
@@ -451705,10 +451722,18 @@ PrefabInstance:
propertyPath: gardenerChaseAudioClip
value:
objectReference: {fileID: 6418180475301049370, guid: 97ccaa2fcf396f446aa7fde8586d225a, type: 2}
- target: {fileID: 6510906053583315767, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: gardenerIdleAudioPlayer
value:
objectReference: {fileID: 21238932}
- target: {fileID: 6510906053583315767, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: m_EditorClassIdentifier
value: '::'
objectReference: {fileID: 0}
- target: {fileID: 6510906053583315767, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: gardenerRunningAudioPlayer
value:
objectReference: {fileID: 1682591191}
- target: {fileID: 7508885060277519207, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: m_Enabled
value: 1
@@ -463815,6 +463840,7 @@ GameObject:
- component: {fileID: 1682591186}
- component: {fileID: 1682591189}
- component: {fileID: 1682591190}
- component: {fileID: 1682591191}
m_Layer: 10
m_Name: GardenerRunning
m_TagString: Untagged
@@ -464010,6 +464036,22 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &1682591191
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1682591184}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
audioSourceType: 1
audioSource: {fileID: 0}
clipPriority: 0
sourcePriority: 1
--- !u!1001 &1687785381
PrefabInstance:
m_ObjectHideFlags: 0
@@ -477028,8 +477070,132 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 6004009293778554413, guid: 1fda7fccaa5fbd04695f4c98d29bcbe0, type: 3}
insertIndex: -1
addedObject: {fileID: 872605980}
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 2114204102434534, guid: 1fda7fccaa5fbd04695f4c98d29bcbe0, type: 3}
insertIndex: -1
addedObject: {fileID: 4912039252317080713}
- targetCorrespondingSourceObject: {fileID: 2114204102434534, guid: 1fda7fccaa5fbd04695f4c98d29bcbe0, type: 3}
insertIndex: -1
addedObject: {fileID: 4912039252317080712}
m_SourcePrefab: {fileID: 100100000, guid: 1fda7fccaa5fbd04695f4c98d29bcbe0, type: 3}
--- !u!1 &4912039252317080711 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2114204102434534, guid: 1fda7fccaa5fbd04695f4c98d29bcbe0, type: 3}
m_PrefabInstance: {fileID: 4912039252317080710}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4912039252317080712
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4912039252317080711}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
audioSourceType: 3
audioSource: {fileID: 0}
clipPriority: 0
sourcePriority: 0
--- !u!82 &4912039252317080713
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4912039252317080711}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
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!1001 &5288063114372713135
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -28,6 +28,11 @@ public class AppleAudioSource : MonoBehaviour
}
private void Awake()
{
Start();
}
public void InitializeAudioSource()
{
// Route the audio to the correct bus depending on type
@@ -37,7 +42,7 @@ public class AppleAudioSource : MonoBehaviour
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("Critical VO")[0];
break;
case AppleAudioSource.AudioSourceType.VO:
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("VO")[0];
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("Flavor VO")[0];
break;
case AppleAudioSource.AudioSourceType.SFX:
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("SFX")[0];

View File

@@ -7,8 +7,9 @@ using UnityEngine.Audio;
public class GardenerAudioController : MonoBehaviour
{
public AudioSource gardenerAudioPlayer;
public AudioSource mowerAudioPlayer;
public AppleAudioSource gardenerIdleAudioPlayer;
public AppleAudioSource gardenerRunningAudioPlayer;
public AppleAudioSource mowerAudioPlayer;
public AudioResource mowerStartAudio;
public AudioResource mowerLoopAudio;
public AudioResource gardenerFleeAudioClip;
@@ -23,15 +24,11 @@ public class GardenerAudioController : MonoBehaviour
{
}
void GardenerIsOnScreen()
{
Debug.Log("Gardener spotted!");
}
public void StartMowerSound()
{
mowerAudioPlayer.Play();
_eventSource = mowerAudioPlayer.RequestEventHandlers();
mowerAudioPlayer.Play(0);
_eventSource = mowerAudioPlayer.audioSource.RequestEventHandlers();
_eventSource.AudioStopped += PlayMowerLoop;
}
@@ -39,22 +36,22 @@ public class GardenerAudioController : MonoBehaviour
private void PlayMowerLoop(object sender, EventArgs e)
{
_eventSource.AudioStopped -= PlayMowerLoop;
mowerAudioPlayer.resource = mowerLoopAudio;
mowerAudioPlayer.loop = true;
mowerAudioPlayer.Play();
mowerAudioPlayer.audioSource.resource = mowerLoopAudio;
mowerAudioPlayer.audioSource.loop = true;
mowerAudioPlayer.Play(0);
}
public void PlayGardenerVOClip(bool fleeing)
{
if (gardenerAudioPlayer.isPlaying) { return; }
if (gardenerRunningAudioPlayer.audioSource.isPlaying) { return; }
if (fleeing) {
gardenerAudioPlayer.resource = gardenerFleeAudioClip;
gardenerAudioPlayer.Play();
gardenerRunningAudioPlayer.audioSource.resource = gardenerFleeAudioClip;
gardenerRunningAudioPlayer.Play(1);
}
if (!fleeing)
{
gardenerAudioPlayer.resource = gardenerChaseAudioClip;
gardenerAudioPlayer.Play();
gardenerRunningAudioPlayer.audioSource.resource = gardenerChaseAudioClip;
gardenerRunningAudioPlayer.Play(1);
}