using Sandbox;
public class HurtBox : Component, Component.ITriggerListener
{
[Property]
public float Damage { get; set; } = 20;
void ITriggerListener.OnTriggerEnter( GameObject other )
{
var damageable = other.GetComponent<IDamageable>();
if ( damageable is not null )
{
damageable.OnDamage( new DamageInfo()
{
Damage = Damage,
Attacker = GameObject,
Position = WorldPosition,
} );
}
}
}