instanciating explosion on slam
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Has been cancelled
Create tag and build when new code gets to main / Test (push) Has been cancelled
Create tag and build when new code gets to main / Export (push) Has been cancelled

This commit is contained in:
2026-01-26 16:34:18 +01:00
parent d79ca44972
commit 2fdc9c7ca8
13 changed files with 122 additions and 32 deletions

View File

@@ -94,7 +94,7 @@ public partial class Enemy : CharacterBody3D,
{
// Anonymous function call to erase return values of ReduceHealth
CDamageable.DamageTaken += (source, record) => ReduceHealth(source, record);
CDamageable.DamageTaken += RegisterKnockback;
CDamageable.DamageTaken += (source, record) => RegisterKnockback(new KnockbackRecord(record));
CHealth.HealthDepleted += Kill;
HealthChanged += (source, record) => _healthbar.OnHealthChanged(record);
}
@@ -127,7 +127,7 @@ public partial class Enemy : CharacterBody3D,
foreach (var body in bodies)
{
if(body is IDamageable spawnable)
spawnable.TakeDamage(new DamageRecord(this, RDamage));
spawnable.TakeDamage(new DamageRecord(GlobalPosition, RDamage));
}
}
@@ -184,10 +184,10 @@ public partial class Enemy : CharacterBody3D,
CallDeferred(Node.MethodName.QueueFree);
}
public void RegisterKnockback(IDamageable source, DamageRecord damageRecord)
public void RegisterKnockback(KnockbackRecord knockbackRecord)
{
if (CKnockback is null) return;
CKnockback.RegisterKnockback(source, damageRecord);
CKnockback.RegisterKnockback(knockbackRecord);
}
public Vector3 ComputeKnockback()