This commit is contained in:
uparupa95
2025-03-01 20:56:38 +09:00
3 changed files with 143 additions and 0 deletions

View File

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

View File

@@ -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<CharacterBase>();
if (player == null && gameStarted)
{
// 플레이어가 죽었을 때
SoundManager.instance.BgSoundPlay(null);
// 필요하다면 gameStarted = false; 등을 설정하여 한 번만 실행되게 함
}
}
private void SpawnBossMonster()
@@ -111,6 +125,23 @@ namespace TON
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)
{
// Debug.Log("모든 웨이브 완료!");

View File

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