플레이어의 공격 기능 추가

EnemyUnit에 Collider 강제
This commit is contained in:
2026-01-27 16:06:42 +09:00
parent 194845a9e1
commit dc2292cd58
12 changed files with 28041 additions and 28 deletions

View File

@@ -6,6 +6,7 @@ namespace Northbound
/// <summary>
/// 적대 유닛 (적대세력 또는 몬스터)
/// </summary>
[RequireComponent(typeof(Collider))]
public class EnemyUnit : NetworkBehaviour, IDamageable, ITeamMember, IVisionProvider
{
[Header("Team Settings")]
@@ -43,8 +44,6 @@ namespace Northbound
// FogOfWar 시스템에 등록
FogOfWarSystem.Instance?.RegisterVisionProvider(this);
Debug.Log($"<color=magenta>[EnemyUnit] {gameObject.name} 스폰됨 (팀: {TeamManager.GetTeamName(_team.Value)})</color>");
}
}
@@ -73,7 +72,6 @@ namespace Northbound
{
if (!TeamManager.CanAttack(attackerTeamMember, this))
{
Debug.Log($"<color=yellow>[EnemyUnit] {TeamManager.GetTeamName(attackerTeamMember.GetTeam())} 팀은 {TeamManager.GetTeamName(_team.Value)} 팀을 공격할 수 없습니다.</color>");
return;
}
}
@@ -82,8 +80,6 @@ namespace Northbound
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
_currentHealth.Value -= actualDamage;
Debug.Log($"<color=red>[EnemyUnit] {gameObject.name} ({TeamManager.GetTeamName(_team.Value)})이(가) {actualDamage} 데미지를 받았습니다. 남은 체력: {_currentHealth.Value}/{maxHealth}</color>");
// 데미지 이펙트
ShowDamageEffectClientRpc();
@@ -98,8 +94,6 @@ namespace Northbound
{
if (!IsServer) return;
Debug.Log($"<color=red>[EnemyUnit] {gameObject.name} ({TeamManager.GetTeamName(_team.Value)})이(가) 파괴되었습니다! (공격자: {attackerId})</color>");
// 파괴 이펙트
ShowDestroyEffectClientRpc();
@@ -118,7 +112,7 @@ namespace Northbound
}
}
[ClientRpc]
[Rpc(SendTo.ClientsAndHost)]
private void ShowDamageEffectClientRpc()
{
if (damageEffectPrefab != null)
@@ -128,7 +122,7 @@ namespace Northbound
}
}
[ClientRpc]
[Rpc(SendTo.ClientsAndHost)]
private void ShowDestroyEffectClientRpc()
{
if (destroyEffectPrefab != null)