Merge branch 'dev' of https://github.com/2aurore/Gameton-06 into dev
This commit is contained in:
@@ -40,8 +40,10 @@ namespace TON
|
||||
[SerializeField] private float mpRecoveryRate = 1f; // MP 회복량
|
||||
[SerializeField] private float mpRecoveryInterval = 3f; // 회복 간격(초)
|
||||
[SerializeField] private bool isRecovering = false;
|
||||
|
||||
|
||||
|
||||
public AudioClip _attackSound;
|
||||
public AudioClip _deathSound;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
@@ -172,6 +174,8 @@ namespace TON
|
||||
isAttack = true;
|
||||
// 공격 애니메이션 적용
|
||||
animator.Play("Default Attack");
|
||||
|
||||
SoundManager.instance.SFXPlay("Attack", _attackSound);
|
||||
|
||||
// 공격 범위 Collider 활성화
|
||||
attackCollider.EnableCollider(true);
|
||||
@@ -269,6 +273,7 @@ namespace TON
|
||||
if (currentHP <= 0f && prevHP > 0)
|
||||
{
|
||||
Dead();
|
||||
SoundManager.instance.SFXPlay("Death", _deathSound);
|
||||
}
|
||||
|
||||
// 체력이 0 보다 클때만 피격 모션 실행
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
@@ -84,11 +89,20 @@ namespace TON
|
||||
activeMonsters.RemoveAll(monster => monster == null);
|
||||
|
||||
// 모든 몬스터가 죽었는지 확인하고 다음 웨이브 준비
|
||||
if (activeMonsters.Count == 0 && currentWave > 0 && !isWaitingForNextWave)
|
||||
if (activeMonsters.Count == 0 && currentWave > 0 && currentWave < 11 && !isWaitingForNextWave)
|
||||
{
|
||||
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()
|
||||
@@ -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)
|
||||
{
|
||||
@@ -235,6 +266,8 @@ namespace TON
|
||||
{
|
||||
if (currentWave != 11 && GameObject.Find("TON.Player").GetComponentInChildren<CharacterBase>() != null)
|
||||
{
|
||||
SoundManager.instance.BgSoundPlay(null);
|
||||
|
||||
float timer = nextWaveDelay;
|
||||
|
||||
while (timer > 0)
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class SoundManager : MonoBehaviour
|
||||
{
|
||||
public AudioSource bgSound;
|
||||
|
||||
public static SoundManager instance;
|
||||
|
||||
private void Awake()
|
||||
@@ -14,12 +17,20 @@ namespace TON
|
||||
{
|
||||
instance = this;
|
||||
DontDestroyOnLoad(instance);
|
||||
// 씬 로드 이벤트에 리스너 등록
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
// 씬이 바뀔 때마다 배경 음악 종료
|
||||
BgSoundPlay(null);
|
||||
}
|
||||
|
||||
public void SFXPlay(string sfxName, AudioClip clip)
|
||||
{
|
||||
@@ -31,5 +42,13 @@ namespace TON
|
||||
|
||||
Destroy(go, clip.length);
|
||||
}
|
||||
|
||||
public void BgSoundPlay(AudioClip clip)
|
||||
{
|
||||
bgSound.clip = clip;
|
||||
bgSound.loop = true;
|
||||
bgSound.volume = 1f;
|
||||
bgSound.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user