diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000..e075bc4 --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f4491d147de80494c9661843ce4d210b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio.meta b/Assets/Resources/Audio.meta similarity index 100% rename from Assets/Audio.meta rename to Assets/Resources/Audio.meta diff --git a/Assets/Resources/Audio/Jump.ogg b/Assets/Resources/Audio/Jump.ogg new file mode 100644 index 0000000..562c69b Binary files /dev/null and b/Assets/Resources/Audio/Jump.ogg differ diff --git a/Assets/Resources/Audio/Jump.ogg.meta b/Assets/Resources/Audio/Jump.ogg.meta new file mode 100644 index 0000000..029d8c2 --- /dev/null +++ b/Assets/Resources/Audio/Jump.ogg.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 763a14f63bd818b43b8633645031c507 +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/Audio/Upbeat Loop.ogg b/Assets/Resources/Audio/Upbeat Loop.ogg similarity index 100% rename from Assets/Audio/Upbeat Loop.ogg rename to Assets/Resources/Audio/Upbeat Loop.ogg diff --git a/Assets/Audio/Upbeat Loop.ogg.meta b/Assets/Resources/Audio/Upbeat Loop.ogg.meta similarity index 100% rename from Assets/Audio/Upbeat Loop.ogg.meta rename to Assets/Resources/Audio/Upbeat Loop.ogg.meta diff --git a/Assets/Scenes/LevelOne.unity b/Assets/Scenes/LevelOne.unity index d03d43b..8582a6a 100644 --- a/Assets/Scenes/LevelOne.unity +++ b/Assets/Scenes/LevelOne.unity @@ -1688,6 +1688,146 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} +--- !u!1 &925144586 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 925144589} + - component: {fileID: 925144588} + - component: {fileID: 925144587} + m_Layer: 0 + m_Name: SoundManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &925144587 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 925144586} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc9d3b5f9d5d60b4596f3d065b900e30, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!82 &925144588 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 925144586} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 0 + 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!4 &925144589 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 925144586} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1008122161 GameObject: m_ObjectHideFlags: 0 @@ -1887,7 +2027,7 @@ AudioSource: OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 8300000, guid: e577eae12053a244898c3c94f7637fc3, type: 3} m_PlayOnAwake: 1 - m_Volume: 1 + m_Volume: 0.188 m_Pitch: 1 Loop: 1 Mute: 0 diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 0761ec9..d258d3a 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -118,6 +118,7 @@ public class Player : MonoBehaviour // Jump if (Input.GetKeyDown(KeyCode.Space) && IsPlayerOnGround()) { + SoundManagerScript.PlaySound("jump"); rigidBody.velocity += new Vector2(0, jumpSpeed); rigidBody.velocity = new Vector2(rigidBody.velocity.x, Mathf.Clamp(rigidBody.velocity.y, 0, jumpSpeed)); diff --git a/Assets/Scripts/SoundManagerScript.cs b/Assets/Scripts/SoundManagerScript.cs new file mode 100644 index 0000000..85dce66 --- /dev/null +++ b/Assets/Scripts/SoundManagerScript.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SoundManagerScript : MonoBehaviour +{ + + public static AudioClip jumpSound; + static AudioSource audioSrc; + + // Start is called before the first frame update + void Start() + { + jumpSound = Resources.Load("Audio/Jump"); + + audioSrc = GetComponent(); + } + + // Update is called once per frame + void Update() + { + + } + + public static void PlaySound(string clip) + { + switch (clip) + { + case "jump": + audioSrc.PlayOneShot(jumpSound); + break; + } + } +} diff --git a/Assets/Scripts/SoundManagerScript.cs.meta b/Assets/Scripts/SoundManagerScript.cs.meta new file mode 100644 index 0000000..ce1eb24 --- /dev/null +++ b/Assets/Scripts/SoundManagerScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc9d3b5f9d5d60b4596f3d065b900e30 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: