Added the menu and march music

This commit is contained in:
Jeremy Smitherman 2026-04-25 17:57:32 -05:00
parent f45007b9f9
commit a384c8b2f4
10 changed files with 378 additions and 49 deletions

View File

@ -6,14 +6,11 @@
<component name="ChangeListManager">
<list default="true" id="60468364-7d9c-427f-83f9-f6cd83ef8783" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.SpringJam2026/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.SpringJam2026/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Prefabs/UI/MainMenu.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Prefabs/UI/MainMenu.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scenes/Bootstrap.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/Bootstrap.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scenes/Game.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/Game.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Management/Services.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Management/Services.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/State/Game/GameRunningState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/State/Game/GameRunningState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Management/BGM.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Management/BGM.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player/Movement.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player/Movement.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/State/Game/MainMenuState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/State/Game/MainMenuState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UI/DeathScreen.uxml" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UI/DeathScreen.uxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UI/Tutorial.uxml" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UI/Tutorial.uxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/State/Game/StartGameState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/State/Game/StartGameState.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -27,6 +24,7 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/41d29b352f6a475ab1bf7c6628b8279046ae00/ac/3f176129/ExceptionDispatchInfo.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/500f267b66d74c678b3466bfed6b3d28212800/32/2bc2e6e7/Object.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Management/InputRouter.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Player/Movement.cs" root0="FORCE_HIGHLIGHTING" />
@ -115,15 +113,13 @@
<option name="useMixedMode" value="false" />
<method v="2" />
</configuration>
<configuration name="Attach to Unity Editor" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="Unity Debug" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost" ignored-value-for-modified-check="186296">
<configuration name="Attach to Unity Editor" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="Unity Debug" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost">
<option name="allowRunningInParallel" value="false" />
<option name="listenPortForConnections" value="false" />
<option name="pid" value="186296" />
<option name="pid" />
<option name="projectPathOnTarget" />
<option name="runtimes">
<list>
<MonoRuntime />
</list>
<list />
</option>
<option name="selectedOptions">
<list />
@ -144,7 +140,8 @@
<updated>1777050991106</updated>
<workItem from="1777050993247" duration="19210000" />
<workItem from="1777098508515" duration="3575000" />
<workItem from="1777126978640" duration="21182000" />
<workItem from="1777126978640" duration="21766000" />
<workItem from="1777156670320" duration="1121000" />
</task>
<servers />
</component>

BIN
Assets/Audio/Tracks/march.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -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:

BIN
Assets/Audio/Tracks/title.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -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:

View File

@ -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

View File

@ -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],
};

View File

@ -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)

View File

@ -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);

View File

@ -1,4 +1,5 @@
using System.Collections;
using Management;
using UnityEngine;
using UnityEngine.SceneManagement;