2026-05-21 23:37:34 +09:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace DamageSystem
|
|
|
|
|
{
|
|
|
|
|
public class DamageableManagerAI : DamageableManager
|
|
|
|
|
{
|
|
|
|
|
protected override void Awake()
|
|
|
|
|
{
|
|
|
|
|
base.Awake();
|
|
|
|
|
|
|
|
|
|
OnDamage.AddListener( ApplyImpactForce );
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-26 18:54:56 +09:00
|
|
|
protected override void ApplyImpactForce(DamageInfo info, DamageablePart damageable)
|
2026-05-21 23:37:34 +09:00
|
|
|
{
|
|
|
|
|
//if this AI if no dead it is being controlled by the Animator so dont apply any impact force
|
|
|
|
|
if (!IsDead)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (com != null && info.damageType == DamageType.Explosion)
|
|
|
|
|
{
|
|
|
|
|
com.AddExplosionForce( info.hitForce, info.hitPoint, info.explosionRadius, info.upwardsModifier, info.forceMode );
|
|
|
|
|
}
|
|
|
|
|
else if (damageable.RB != null && info.damageType == DamageType.Shoot)
|
|
|
|
|
{
|
|
|
|
|
damageable.RB.AddForceAtPosition( info.hitForce * info.hitDir, info.hitPoint, info.forceMode );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|