크립 캠프 내 모든 크립이 한번에 플레이어를 인식하도록 변경
This commit is contained in:
@@ -61,6 +61,10 @@ namespace Northbound
|
||||
[Header("Events")]
|
||||
public System.Action<GameObject> OnAttackPerformed;
|
||||
|
||||
[Header("Camp Alert System")]
|
||||
[Tooltip("이 크립이 속한 캠프 (null이면 독립 크립)")]
|
||||
public CreepCamp creepCamp;
|
||||
|
||||
private NavMeshAgent _agent;
|
||||
private EnemyUnit _enemyUnit;
|
||||
private Core _core;
|
||||
@@ -164,6 +168,13 @@ namespace Northbound
|
||||
if (player != null)
|
||||
{
|
||||
SetTargetPlayer(player);
|
||||
|
||||
// 캠프 내 모든 크립에게 경고 전파
|
||||
if (creepCamp != null)
|
||||
{
|
||||
creepCamp.AlertAllCreeps(player, this);
|
||||
}
|
||||
|
||||
TransitionToState(EnemyAIState.ChasePlayer);
|
||||
}
|
||||
}
|
||||
@@ -189,6 +200,13 @@ namespace Northbound
|
||||
if (detectedPlayer != null)
|
||||
{
|
||||
SetTargetPlayer(detectedPlayer);
|
||||
|
||||
// 캠프 내 모든 크립에게 경고 전파
|
||||
if (creepCamp != null)
|
||||
{
|
||||
creepCamp.AlertAllCreeps(detectedPlayer, this);
|
||||
}
|
||||
|
||||
TransitionToState(EnemyAIState.ChasePlayer);
|
||||
return;
|
||||
}
|
||||
@@ -723,6 +741,34 @@ namespace Northbound
|
||||
return _currentState.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 캠프 내 다른 크립으로부터 경고 전파 받음
|
||||
/// </summary>
|
||||
public void ReceiveAlert(GameObject target)
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if (target == null) return;
|
||||
|
||||
// 이미 해당 타겟을 추적 중이면 무시
|
||||
if (_currentState.Value == EnemyAIState.ChasePlayer || _currentState.Value == EnemyAIState.Attack)
|
||||
{
|
||||
GameObject currentTarget = GetTargetPlayer();
|
||||
if (currentTarget == target) return;
|
||||
}
|
||||
|
||||
// 이미 사망한 타겟은 무시
|
||||
IDamageable damageable = target.GetComponentInParent<IDamageable>();
|
||||
if (damageable != null && damageable.IsDead()) return;
|
||||
|
||||
// 타겟 설정 및 추적 시작
|
||||
SetTargetPlayer(target);
|
||||
|
||||
if (_currentState.Value == EnemyAIState.Idle || _currentState.Value == EnemyAIState.MoveToCore)
|
||||
{
|
||||
TransitionToState(EnemyAIState.ChasePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Gizmos (기존 코드 유지)
|
||||
|
||||
Reference in New Issue
Block a user