This commit is contained in:
aube.lee
2025-03-01 20:09:59 +09:00
21 changed files with 1082 additions and 84 deletions

View File

@@ -41,6 +41,10 @@ namespace TON
private CharacterBase _characterBase;
public AudioClip _attackSound;
public AudioClip _deathSound;
public AudioClip _hitSound;
private void Start()
{
_animator = GetComponent<Animator>(); // 애니메이터 컴포넌트 초기화
@@ -128,7 +132,9 @@ namespace TON
{
float prevHP = currentHP; // 몬스터의 체력을 감소시키고, 죽었을 경우 파괴 처리
currentHP -= damage;
SoundManager.instance.SFXPlay("Hit", _hitSound);
UpdateHPBar(currentHP);
if (prevHP > 0 && currentHP <= 0)
@@ -180,6 +186,7 @@ namespace TON
_characterBase.ApplyDamage(damage);
SoundManager.instance.SFXPlay("Attack", _attackSound);
// Debug.Log($" 몬스터 공격! 최종 데미지: {damage}"); // 데미지 출력
}
@@ -218,6 +225,7 @@ namespace TON
public void DestroyMonster()
{
RewardData();
SoundManager.instance.SFXPlay("Death", _deathSound);
Destroy(gameObject); // 몬스터 파괴
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e16344df7c8f56b4095502fb077d9f83
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
public class SoundManager : MonoBehaviour
{
public static SoundManager instance;
private void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(instance);
}
else
{
Destroy(gameObject);
}
}
public void SFXPlay(string sfxName, AudioClip clip)
{
GameObject go = new GameObject(sfxName + "Sound");
AudioSource audiosource = go.AddComponent<AudioSource>();
audiosource.clip = clip;
audiosource.Play();
Destroy(go, clip.length);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 023ac119be3a3d24c816494653c341dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -195,6 +195,13 @@ namespace TON
public void OnClickCloseButton()
{
StartCoroutine(CloseButtonDelay());
}
IEnumerator CloseButtonDelay()
{
yield return new WaitForSeconds(0.2f); // 0.2초 대기
UIManager.Hide<SkillSettingUI>(UIList.SkillSettingUI);
}
}

View File

@@ -7,14 +7,6 @@ namespace TON
public class TitleUI : UIBase
{
public CharaterSelectUI charaterSelectUI;
AudioSource _buttonAudio;
private void Start()
{
_buttonAudio = gameObject.AddComponent<AudioSource>();
DontDestroyOnLoad(this.transform.parent.gameObject);
}
public void OnClickStartButton()
{
@@ -23,7 +15,7 @@ namespace TON
IEnumerator StartButtonDelay()
{
yield return new WaitForSeconds(1f); // 1초 대기
yield return new WaitForSeconds(0.2f); // 0.2초 대기
// Main.Singleton?.ChangeScene(SceneType.Ingame);
UIManager.Hide<TitleUI>(UIList.TitleUI);