This commit is contained in:
CortexCore
2024-05-31 01:23:15 +08:00
parent c798b224be
commit 299082fe27
164 changed files with 3604 additions and 2018 deletions

View File

@@ -90,11 +90,6 @@ namespace BITKit.Entities
OnSetAlive?.Invoke(alive);
}
private void AddHP(int hp)
{
OnHealthPointChangedInternal(healthPoint, healthPoint += hp);
}
private void OnGetDamage(DamageMessage damageMessage)
{
if (damageMessage.Target != UnityEntity) return;
@@ -114,11 +109,23 @@ namespace BITKit.Entities
break;
}
}
if (Data.Get<bool>("god") is false)
AddHP(-damage);
damageMessage.Damage = damage;
if (Data.Get<bool>("god") is false)
{
healthPoint-=damage;
}
IsAlive = healthPoint >= 0;
OnSetHealthPoint?.Invoke(healthPoint);
OnDamageRelease?.Invoke(damageMessage);
if (!IsAlive)
{
OnSetAliveInternal(false);
}
}
}
#if UNITY_EDITOR