기본 배치 건물이 시야를 제공하도록 변경
This commit is contained in:
@@ -6,8 +6,16 @@ namespace Northbound
|
||||
/// <summary>
|
||||
/// 블랙스미스 건물 - 업그레이드 구매 가능
|
||||
/// </summary>
|
||||
public class Blacksmith : MonoBehaviour, IInteractable
|
||||
public class Blacksmith : NetworkBehaviour, IInteractable, IVisionProvider, ITeamMember
|
||||
{
|
||||
[Header("Vision Settings")]
|
||||
[Tooltip("블랙스미스가 제공하는 시야 범위")]
|
||||
public float visionRange = 10f;
|
||||
|
||||
[Header("Team")]
|
||||
[Tooltip("건물의 팀")]
|
||||
public TeamType initialTeam = TeamType.Player;
|
||||
|
||||
[Header("UI Reference")]
|
||||
[SerializeField] private GameObject _upgradePopupPrefab;
|
||||
|
||||
@@ -55,9 +63,6 @@ namespace Northbound
|
||||
return transform;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private void OpenUpgradePopup(ulong playerId)
|
||||
@@ -115,12 +120,63 @@ namespace Northbound
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
public override void OnDestroy()
|
||||
{
|
||||
if (_popupInstance != null)
|
||||
{
|
||||
Destroy(_popupInstance);
|
||||
}
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
#region NetworkBehaviour Overrides
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
if (IsServer)
|
||||
{
|
||||
// 시야 제공자로 등록
|
||||
FogOfWarSystem.Instance?.RegisterVisionProvider(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
if (IsServer)
|
||||
{
|
||||
// 시야 제공자 등록 해제
|
||||
FogOfWarSystem.Instance?.UnregisterVisionProvider(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IVisionProvider Implementation
|
||||
|
||||
public ulong GetOwnerId() => 0; // 블랙스미스는 모든 플레이어에게 시야 제공
|
||||
|
||||
public float GetVisionRange() => visionRange;
|
||||
|
||||
Transform IVisionProvider.GetTransform() => transform;
|
||||
|
||||
public bool IsActive() => IsSpawned;
|
||||
|
||||
TeamType IVisionProvider.GetTeam() => initialTeam;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITeamMember Implementation
|
||||
|
||||
public TeamType GetTeam() => initialTeam;
|
||||
|
||||
public bool IsDead() => false; // 블랙스미스는 파괴되지 않음
|
||||
|
||||
public void SetTeam(TeamType team)
|
||||
{
|
||||
// 블랙스미스의 팀은 변경할 수 없음
|
||||
Debug.LogWarning("[Blacksmith] 블랙스미스의 팀은 변경할 수 없습니다.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user