적 AI에 어그로 시스템 추가
This commit is contained in:
@@ -41,6 +41,11 @@ namespace Northbound
|
||||
/// </summary>
|
||||
public event System.Action<ulong> OnDeath;
|
||||
|
||||
/// <summary>
|
||||
/// 데미지를 받았을 때 발생하는 이벤트 (매개변수: attackerId, damage)
|
||||
/// </summary>
|
||||
public event System.Action<ulong, int> OnDamageTaken;
|
||||
|
||||
private UnitHealthBar _healthBar;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
@@ -116,10 +121,13 @@ namespace Northbound
|
||||
|
||||
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
|
||||
_currentHealth.Value -= actualDamage;
|
||||
|
||||
|
||||
// 데미지 이펙트
|
||||
ShowDamageEffectClientRpc();
|
||||
|
||||
// 데미지 받음 이벤트 발생 (AI 어그로 시스템용)
|
||||
OnDamageTaken?.Invoke(attackerId, actualDamage);
|
||||
|
||||
// 체력이 0이 되면 파괴
|
||||
if (_currentHealth.Value <= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user