Files
BeatSaber/Assets/VRBeatsKit/Modules/VRDamageSystem/DamageableManagerAI.cs
T

31 lines
984 B
C#
Raw Normal View History

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)
{
//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 );
}
}
}
}