diff --git a/.idea/.idea.SpringJam2026/.idea/workspace.xml b/.idea/.idea.SpringJam2026/.idea/workspace.xml index 9fb8aaf..61eba70 100644 --- a/.idea/.idea.SpringJam2026/.idea/workspace.xml +++ b/.idea/.idea.SpringJam2026/.idea/workspace.xml @@ -6,14 +6,11 @@ - - - - + + - - + + @@ -115,15 +113,13 @@ diff --git a/Assets/Audio/Tracks/march.wav b/Assets/Audio/Tracks/march.wav new file mode 100644 index 0000000..d5a8a31 --- /dev/null +++ b/Assets/Audio/Tracks/march.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5065e260674bec037304c227bc8ac4941a0337a4591caf7d2706144286d33bc4 +size 12701490 diff --git a/Assets/Audio/Tracks/march.wav.meta b/Assets/Audio/Tracks/march.wav.meta new file mode 100644 index 0000000..8d15512 --- /dev/null +++ b/Assets/Audio/Tracks/march.wav.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 28ffc54b48383bb44b0f22b79f8f51ce +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: diff --git a/Assets/Audio/Tracks/title.wav b/Assets/Audio/Tracks/title.wav new file mode 100644 index 0000000..143a9ce --- /dev/null +++ b/Assets/Audio/Tracks/title.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45cea0a35ed9954ce09018a4e6e07d3415dac141a4238d908689cfc6e19c1a52 +size 6351090 diff --git a/Assets/Audio/Tracks/title.wav.meta b/Assets/Audio/Tracks/title.wav.meta new file mode 100644 index 0000000..d72bb7f --- /dev/null +++ b/Assets/Audio/Tracks/title.wav.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 12da608c3660fb0478505a963c5c3502 +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: diff --git a/Assets/Scenes/Bootstrap.unity b/Assets/Scenes/Bootstrap.unity index cd1ac34..74ed749 100644 --- a/Assets/Scenes/Bootstrap.unity +++ b/Assets/Scenes/Bootstrap.unity @@ -331,6 +331,264 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cae18a7c1c4314e4fb239ece5cef4996, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::Management.InputRouter +--- !u!1 &1132608102 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1132608103} + - component: {fileID: 1132608104} + m_Layer: 0 + m_Name: BGMMenu + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1132608103 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1132608102} + serializedVersion: 2 + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1755353619} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!82 &1132608104 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1132608102} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 8781117415510498633, guid: b8f5fa5f6f2c53443a6d2fc322b400eb, type: 2} + m_audioClip: {fileID: 0} + m_Resource: {fileID: 8300000, guid: 12da608c3660fb0478505a963c5c3502, type: 3} + m_PlayOnAwake: 1 + 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!1 &1207006060 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1207006061} + - component: {fileID: 1207006062} + m_Layer: 0 + m_Name: BGMMarch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1207006061 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1207006060} + serializedVersion: 2 + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1755353619} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!82 &1207006062 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1207006060} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 8781117415510498633, guid: b8f5fa5f6f2c53443a6d2fc322b400eb, type: 2} + m_audioClip: {fileID: 0} + m_Resource: {fileID: 8300000, guid: 28ffc54b48383bb44b0f22b79f8f51ce, type: 3} + m_PlayOnAwake: 0 + m_Volume: 0 + 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!1 &1327356647 GameObject: m_ObjectHideFlags: 0 @@ -620,6 +878,8 @@ MonoBehaviour: audioSources: - {fileID: 1926006213} - {fileID: 1940272761} + - {fileID: 1207006062} + menuSource: {fileID: 1132608104} --- !u!4 &1755353619 Transform: m_ObjectHideFlags: 0 @@ -633,9 +893,10 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1132608103} - {fileID: 1926006212} - {fileID: 1940272760} - - {fileID: 2045788190} + - {fileID: 1207006061} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1926006211 @@ -682,7 +943,7 @@ AudioSource: OutputAudioMixerGroup: {fileID: 8781117415510498633, guid: b8f5fa5f6f2c53443a6d2fc322b400eb, type: 2} m_audioClip: {fileID: 0} m_Resource: {fileID: 8300000, guid: b772ccf820a0cee42936f0c7a7e82d07, type: 3} - m_PlayOnAwake: 1 + m_PlayOnAwake: 0 m_Volume: 1 m_Pitch: 1 Loop: 1 @@ -811,7 +1072,7 @@ AudioSource: OutputAudioMixerGroup: {fileID: 8781117415510498633, guid: b8f5fa5f6f2c53443a6d2fc322b400eb, type: 2} m_audioClip: {fileID: 0} m_Resource: {fileID: 8300000, guid: 2c8fd733dc700f040a862447847c4a13, type: 3} - m_PlayOnAwake: 1 + m_PlayOnAwake: 0 m_Volume: 0 m_Pitch: 1 Loop: 1 @@ -951,37 +1212,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2045788189 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2045788190} - m_Layer: 0 - m_Name: BGMVictory - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2045788190 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2045788189} - serializedVersion: 2 - 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_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1755353619} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Management/BGM.cs b/Assets/Scripts/Management/BGM.cs index 28b651c..723d098 100644 --- a/Assets/Scripts/Management/BGM.cs +++ b/Assets/Scripts/Management/BGM.cs @@ -13,6 +13,7 @@ namespace Management { Core, Muted, + March, Victory } @@ -23,19 +24,52 @@ namespace Management // the audiosource that will play the music [SerializeField] private AudioSource[] audioSources; + [SerializeField] private AudioSource menuSource; + + public void MenuToGameMusic() + { + StartCoroutine(MenuToGameMusicRoutine()); + } + + private IEnumerator MenuToGameMusicRoutine() + { + var t = 1f; + var timer = 0f; + + foreach(var a in audioSources) + { + a.Play(); + } + + while (timer < t) + { + timer += Time.deltaTime; + menuSource.volume = Mathf.Lerp(1, 0, timer / t); + yield return null; + } + + timer = 0; + _currentlyPlaying = TrackType.Muted; + while (timer < t) + { + timer += Time.deltaTime; + audioSources[0].volume = Mathf.Lerp(0, 1, timer / t); + yield return null; + } + } // Fades out the currently playing music if playing, then fades in // the provided clip over the amount of time specified. // if t == 0 swap is instant. public void FadeIn(TrackType type, float t = 0.5f) { + if (type == _currentlyPlaying) return; StopAllCoroutines(); - var currentAudioSource = _currentlyPlaying switch { TrackType.Muted => audioSources[0], TrackType.Core => audioSources[1], - TrackType.Victory => audioSources[2], + TrackType.March => audioSources[2], _ => audioSources[0], }; @@ -43,7 +77,7 @@ namespace Management { TrackType.Muted => audioSources[0], TrackType.Core => audioSources[1], - TrackType.Victory => audioSources[2], + TrackType.March => audioSources[2], _ => audioSources[0], }; diff --git a/Assets/Scripts/Player/Movement.cs b/Assets/Scripts/Player/Movement.cs index 924590f..c718af0 100644 --- a/Assets/Scripts/Player/Movement.cs +++ b/Assets/Scripts/Player/Movement.cs @@ -55,6 +55,7 @@ namespace Player private Vector2 _airJumpDir; private bool _autoDrive = true; private bool _deathArmed; + private bool _firstSpring; private void Awake() { @@ -144,6 +145,7 @@ namespace Player if (_fireSpring) { + _firstSpring = true; Services.Instance.SFX.PlayOneShot(springSound); Services.Instance.BGM.FadeIn(BGM.TrackType.Core); _fireSpring = false; @@ -170,6 +172,18 @@ namespace Player animator.SetBool(Grounded, _grounded); animator.SetFloat(Speed, Mathf.Abs(_rb.linearVelocity.x)); animator.SetFloat(Vspeed, _rb.linearVelocity.y); + + if (_firstSpring) + { + if (_autoDrive) + { + Services.Instance.BGM.FadeIn(BGM.TrackType.March); + } + else + { + Services.Instance.BGM.FadeIn(BGM.TrackType.Core); + } + } } private IEnumerator ImpactPause(float pauseTime) diff --git a/Assets/Scripts/State/Game/MainMenuState.cs b/Assets/Scripts/State/Game/MainMenuState.cs index 6725508..0799344 100644 --- a/Assets/Scripts/State/Game/MainMenuState.cs +++ b/Assets/Scripts/State/Game/MainMenuState.cs @@ -54,6 +54,7 @@ namespace State.Game private IEnumerator ExecuteStartGame() { + Services.Instance.BGM.MenuToGameMusic(); _mainMenuInstance.OnStartGame -= HandleStartGame; Services.Instance.ShowTransition(true); yield return new WaitForSeconds(2f); diff --git a/Assets/Scripts/State/Game/StartGameState.cs b/Assets/Scripts/State/Game/StartGameState.cs index fdc5bda..9ea53b3 100644 --- a/Assets/Scripts/State/Game/StartGameState.cs +++ b/Assets/Scripts/State/Game/StartGameState.cs @@ -1,4 +1,5 @@ using System.Collections; +using Management; using UnityEngine; using UnityEngine.SceneManagement;