From d29101526ef07455f201eec2d181452fc3cb5016 Mon Sep 17 00:00:00 2001 From: Mingu Kim Date: Sat, 1 Mar 2025 20:51:18 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=85=8C=EC=9D=B4=EC=A7=80=EC=97=90?= =?UTF-8?q?=20=EB=94=B0=EB=A5=B8=20BGM=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Gameton/Scenes/Stage 4.unity | 102 ++++++++++++++++++ .../Gameton/Scripts/Monster/MonsterSpawner.cs | 31 ++++++ .../Gameton/Scripts/Sound/SoundManager.cs | 10 ++ 3 files changed, 143 insertions(+) diff --git a/Gameton-06/Assets/Gameton/Scenes/Stage 4.unity b/Gameton-06/Assets/Gameton/Scenes/Stage 4.unity index 17ab3d44..53ec2cac 100644 --- a/Gameton-06/Assets/Gameton/Scenes/Stage 4.unity +++ b/Gameton-06/Assets/Gameton/Scenes/Stage 4.unity @@ -20061,6 +20061,10 @@ MonoBehaviour: monsterPrefabB: {fileID: 0} bossPrefab: {fileID: 3667660097767351871, guid: ef14281ca23119941b755a7bff7ff6c8, type: 3} waveCounter: {fileID: 312801291} + _13StageSound: {fileID: 8300000, guid: 4f6e8dfda91d08a4ba54929ea80c3305, type: 3} + _46StageSound: {fileID: 8300000, guid: ee8fe21d7aa40914f94c8d6096ab5f45, type: 3} + _79StageSound: {fileID: 8300000, guid: dcc4a0adc983e3946af96ad9a7d8d239, type: 3} + _10StageSound: {fileID: 8300000, guid: d3e291fdf326c5644ae98d97b25436be, type: 3} --- !u!4 &1103604663 Transform: m_ObjectHideFlags: 0 @@ -34287,6 +34291,7 @@ GameObject: m_Component: - component: {fileID: 2068238029} - component: {fileID: 2068238028} + - component: {fileID: 2068238030} m_Layer: 0 m_Name: SoundManager m_TagString: Untagged @@ -34306,6 +34311,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 023ac119be3a3d24c816494653c341dc, type: 3} m_Name: m_EditorClassIdentifier: + bgSound: {fileID: 2068238030} --- !u!4 &2068238029 Transform: m_ObjectHideFlags: 0 @@ -34321,6 +34327,102 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!82 &2068238030 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2068238027} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + 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!1 &2135657550 GameObject: m_ObjectHideFlags: 0 diff --git a/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs b/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs index d79d8065..0537f5dd 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs @@ -40,6 +40,11 @@ namespace TON [SerializeField] public TextMeshProUGUI waveCounter; + public AudioClip _13StageSound; + public AudioClip _46StageSound; + public AudioClip _79StageSound; + public AudioClip _10StageSound; + // Start is called before the first frame update void Start() { @@ -89,6 +94,15 @@ namespace TON isWaitingForNextWave = true; StartCoroutine(StartNextWaveWithDelay()); } + + // 플레이어 존재 여부 확인 + var player = GameObject.Find("TON.Player").GetComponentInChildren(); + if (player == null && gameStarted) + { + // 플레이어가 죽었을 때 + SoundManager.instance.BgSoundPlay(null); + // 필요하다면 gameStarted = false; 등을 설정하여 한 번만 실행되게 함 + } } private void SpawnBossMonster() @@ -110,6 +124,23 @@ namespace TON StageManager.Singleton.SetWaveData(currentWave); // 웨이브 정보 전달. currentWave++; + + if (0 < currentWave && currentWave <= 3) + { + SoundManager.instance.BgSoundPlay(_13StageSound); // 1~3스테이지 배경음 + } + else if (3 < currentWave && currentWave <= 6) + { + SoundManager.instance.BgSoundPlay(_46StageSound); // 4~6스테이지 배경음 + } + else if (6 < currentWave && currentWave <= 9) + { + SoundManager.instance.BgSoundPlay(_79StageSound); // 7~9스테이지 배경음 + } + else if(currentWave == 10) + { + SoundManager.instance.BgSoundPlay(_10StageSound); // 10스테이지 배경음 + } if (currentWave > TOTAL_WAVES) { diff --git a/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs b/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs index 2b096fe9..d32e1f2c 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs @@ -6,6 +6,8 @@ namespace TON { public class SoundManager : MonoBehaviour { + public AudioSource bgSound; + public static SoundManager instance; private void Awake() @@ -31,5 +33,13 @@ namespace TON Destroy(go, clip.length); } + + public void BgSoundPlay(AudioClip clip) + { + bgSound.clip = clip; + bgSound.loop = true; + bgSound.volume = 1f; + bgSound.Play(); + } } }