diff --git a/Assets/Resources/Audio/GameOver.wav b/Assets/Resources/Audio/GameOver.wav new file mode 100644 index 0000000..92065e3 Binary files /dev/null and b/Assets/Resources/Audio/GameOver.wav differ diff --git a/Assets/Resources/Audio/GameOver.wav.meta b/Assets/Resources/Audio/GameOver.wav.meta new file mode 100644 index 0000000..4740015 --- /dev/null +++ b/Assets/Resources/Audio/GameOver.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: ed52247b51db5b942a636c14f0b4290c +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Audio/Win.ogg b/Assets/Resources/Audio/Win.ogg new file mode 100644 index 0000000..f9392b6 Binary files /dev/null and b/Assets/Resources/Audio/Win.ogg differ diff --git a/Assets/Resources/Audio/Win.ogg.meta b/Assets/Resources/Audio/Win.ogg.meta new file mode 100644 index 0000000..2a26161 --- /dev/null +++ b/Assets/Resources/Audio/Win.ogg.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 528e0f9bceff67a4e98ab441ac65acde +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/LevelOne.unity b/Assets/Scenes/LevelOne.unity index 73a73f7..01ba314 100644 --- a/Assets/Scenes/LevelOne.unity +++ b/Assets/Scenes/LevelOne.unity @@ -167,6 +167,7 @@ MonoBehaviour: m_EditorClassIdentifier: player: {fileID: 1671840921} camera: {fileID: 1337282922} + music: {fileID: 0} tiles: - {fileID: 11400000, guid: 1f7bfa5ee72002646806268d14bfeb3b, type: 2} - {fileID: 11400000, guid: e85f8319cdf4358448a9002845cfbd5a, type: 2} @@ -46993,7 +46994,7 @@ AudioSource: Mute: 0 Spatialize: 0 SpatializePostEffects: 0 - Priority: 128 + Priority: 219 DopplerLevel: 1 MinDistance: 1 MaxDistance: 500 @@ -47329,7 +47330,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1671840916} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 178, y: 8, z: 0} + m_LocalPosition: {x: 18.5, y: 8, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1008122163} @@ -47691,6 +47692,84 @@ Tilemap: e31: 0 e32: 0 e33: 1 +--- !u!4 &1727766209 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1882958979} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -7.8, y: 7.65, z: 10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1146013793} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1727766210 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1882958979} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 1067504601 + m_SortingLayer: -1 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: e33008ddf5593464c90eced40f3f28e8, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 16, y: 16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1727766211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1882958979} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: af4fa3c5d20488d4fa39fb11819d3f97, type: 3} + m_Name: + m_EditorClassIdentifier: + camera: {fileID: 1337282922} + renderer: {fileID: 1727766210} + scrollRate: {x: 0.4, y: 0.4} --- !u!1001 &1879087608 PrefabInstance: m_ObjectHideFlags: 0 @@ -47818,84 +47897,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &1727766209 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727766208} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -7.8, y: 7.65, z: 10} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1146013793} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1727766210 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727766208} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 1067504601 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: e33008ddf5593464c90eced40f3f28e8, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 16, y: 16} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!114 &1727766211 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727766208} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: af4fa3c5d20488d4fa39fb11819d3f97, type: 3} - m_Name: - m_EditorClassIdentifier: - camera: {fileID: 1337282922} - renderer: {fileID: 1727766210} - scrollRate: {x: 0.4, y: 0.4} --- !u!1 &1895829829 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/EventControls.cs b/Assets/Scripts/EventControls.cs index 95f2308..959337a 100644 --- a/Assets/Scripts/EventControls.cs +++ b/Assets/Scripts/EventControls.cs @@ -9,6 +9,7 @@ public class EventControls : MonoBehaviour { [SerializeField] private Player player; [SerializeField] private Camera camera; + [SerializeField] private GameObject music; [SerializeField] private List tiles; [SerializeField] private List successTiles; [SerializeField] private List failTiles; @@ -159,6 +160,17 @@ public class EventControls : MonoBehaviour .GetValueOrDefault(); } + IEnumerator PlayVictoryMusic() + { + music = GameObject.Find("Music"); + var audioSrc = music.GetComponent(); + audioSrc.Pause(); + SoundManagerScript.PlaySound("win"); + var clipSeconds = SoundManagerScript.audioSrc.clip.length; + yield return new WaitForSeconds(clipSeconds); + audioSrc.Play(); + } + private void PerformControlEvent() { nextControlAccumalator = 0; @@ -185,6 +197,7 @@ public class EventControls : MonoBehaviour // Destroy(currentEnemyCollider.gameObject); // currentEnemyCollider = null; hasFailed = false; + StartCoroutine(PlayVictoryMusic()); } } diff --git a/Assets/Scripts/SoundManagerScript.cs b/Assets/Scripts/SoundManagerScript.cs index 7b13777..91d6ce5 100644 --- a/Assets/Scripts/SoundManagerScript.cs +++ b/Assets/Scripts/SoundManagerScript.cs @@ -8,7 +8,7 @@ public class SoundManagerScript : MonoBehaviour public static AudioClip jumpSound, screamSound, wrongButtonSound, bugLaughSound, drinkSound, eatSound, punchSound, hardPunchSound, slapSound, hardSlapSound, winSound; - static AudioSource audioSrc; + public static AudioSource audioSrc; // Start is called before the first frame update void Start() @@ -23,6 +23,7 @@ public class SoundManagerScript : MonoBehaviour hardPunchSound = Resources.Load("Audio/HardPunch"); slapSound = Resources.Load("Audio/Slap"); hardSlapSound = Resources.Load("Audio/HardSlap"); + winSound = Resources.Load("Audio/Win"); audioSrc = GetComponent(); } @@ -68,6 +69,7 @@ public class SoundManagerScript : MonoBehaviour audioSrc.PlayOneShot(hardSlapSound); break; case "win": + audioSrc.clip = winSound; audioSrc.PlayOneShot(winSound); break;