기본 배치 건물이 시야를 제공하도록 변경
This commit is contained in:
@@ -7,12 +7,15 @@ namespace Northbound
|
||||
/// <summary>
|
||||
/// 플레이어가 자원을 건내받아 게임의 전역 자원으로 관리하는 중앙 허브
|
||||
/// </summary>
|
||||
public class Core : NetworkBehaviour, IInteractable, IDamageable, ITeamMember
|
||||
public class Core : NetworkBehaviour, IInteractable, IDamageable, ITeamMember, IVisionProvider
|
||||
{
|
||||
[Header("Core Settings")]
|
||||
public int maxStorageCapacity = 1000; // 코어의 최대 저장 용량
|
||||
public bool unlimitedStorage = false; // 무제한 저장소
|
||||
|
||||
[Header("Vision")]
|
||||
public float visionRange = 15f; // 코어가 제공하는 시야 범위
|
||||
|
||||
[Header("Health")]
|
||||
public int maxHealth = 1000;
|
||||
public GameObject damageEffectPrefab;
|
||||
@@ -55,6 +58,9 @@ namespace Northbound
|
||||
{
|
||||
_totalResources.Value = 0;
|
||||
_currentHealth.Value = maxHealth;
|
||||
|
||||
// 시야 제공자로 등록
|
||||
FogOfWarSystem.Instance?.RegisterVisionProvider(this);
|
||||
}
|
||||
|
||||
_currentHealth.OnValueChanged += OnHealthChanged;
|
||||
@@ -62,6 +68,12 @@ namespace Northbound
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
if (IsServer)
|
||||
{
|
||||
// 시야 제공자 등록 해제
|
||||
FogOfWarSystem.Instance?.UnregisterVisionProvider(this);
|
||||
}
|
||||
|
||||
_currentHealth.OnValueChanged -= OnHealthChanged;
|
||||
}
|
||||
|
||||
@@ -372,5 +384,19 @@ namespace Northbound
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IVisionProvider Implementation
|
||||
|
||||
public ulong GetOwnerId() => 0; // 코어는 모든 플레이어에게 시야 제공
|
||||
|
||||
public float GetVisionRange() => visionRange;
|
||||
|
||||
Transform IVisionProvider.GetTransform() => transform;
|
||||
|
||||
public bool IsActive() => IsSpawned && !IsDead();
|
||||
|
||||
TeamType IVisionProvider.GetTeam() => TeamType.Player;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user