전장의 안개 기능 개선
미탐험 구역의 모든 오브젝트는 보이지 않음 적이 시야를 제공하는 문제 수정 높은 장애물은 더 먼 거리에서부터 보일 수 있음
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Northbound
|
||||
/// 적대 유닛 (적대세력 또는 몬스터)
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class EnemyUnit : NetworkBehaviour, IDamageable, ITeamMember, IVisionProvider
|
||||
public class EnemyUnit : NetworkBehaviour, IDamageable, ITeamMember
|
||||
{
|
||||
[Header("Team Settings")]
|
||||
[Tooltip("이 유닛의 팀 (Hostile = 적대세력, Monster = 몬스터)")]
|
||||
@@ -15,7 +15,6 @@ namespace Northbound
|
||||
|
||||
[Header("Combat")]
|
||||
public int maxHealth = 100;
|
||||
public float visionRange = 10f;
|
||||
|
||||
[Header("Visual")]
|
||||
public GameObject damageEffectPrefab;
|
||||
@@ -41,20 +40,12 @@ namespace Northbound
|
||||
{
|
||||
_currentHealth.Value = maxHealth;
|
||||
_team.Value = enemyTeam;
|
||||
|
||||
// FogOfWar 시스템에 등록
|
||||
FogOfWarSystem.Instance?.RegisterVisionProvider(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
base.OnNetworkDespawn();
|
||||
|
||||
if (IsServer)
|
||||
{
|
||||
FogOfWarSystem.Instance?.UnregisterVisionProvider(this);
|
||||
}
|
||||
}
|
||||
|
||||
#region IDamageable Implementation
|
||||
@@ -97,9 +88,6 @@ namespace Northbound
|
||||
// 파괴 이펙트
|
||||
ShowDestroyEffectClientRpc();
|
||||
|
||||
// FogOfWar 시스템에서 제거
|
||||
FogOfWarSystem.Instance?.UnregisterVisionProvider(this);
|
||||
|
||||
// 네트워크 오브젝트 파괴
|
||||
Invoke(nameof(DespawnUnit), 0.5f);
|
||||
}
|
||||
@@ -146,28 +134,8 @@ namespace Northbound
|
||||
|
||||
#endregion
|
||||
|
||||
#region IVisionProvider Implementation
|
||||
|
||||
public ulong GetOwnerId() => OwnerClientId;
|
||||
|
||||
public float GetVisionRange() => visionRange;
|
||||
|
||||
public Transform GetTransform() => transform;
|
||||
|
||||
public bool IsActive() => IsSpawned && _currentHealth.Value > 0;
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
// 팀 색상으로 시야 범위 표시
|
||||
Color teamColor = Application.isPlaying
|
||||
? TeamManager.GetTeamColor(_team.Value)
|
||||
: TeamManager.GetTeamColor(enemyTeam);
|
||||
|
||||
Gizmos.color = new Color(teamColor.r, teamColor.g, teamColor.b, 0.3f);
|
||||
Gizmos.DrawWireSphere(transform.position, visionRange);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user