fixed damage composition issue

This commit is contained in:
2026-01-17 17:47:14 +01:00
parent 4ccdbc0ee6
commit 0dcf4a3f99
12 changed files with 92 additions and 93 deletions

View File

@@ -0,0 +1,22 @@
using Godot;
using System;
using Movementtests.interfaces;
[GlobalClass]
public partial class CDamageable : Node, IDamageable
{
[Signal]
public delegate void DamageTakenEventHandler(float damageTaken);
[Export]
public RDamageModifier[] DamageModifiers { get; set; }
public float TakeDamage(RDamage damage)
{
var finalDamage = 0f;
foreach (var damageable in DamageModifiers.ToIDamageables())
finalDamage += damageable.TakeDamage(damage);
EmitSignalDamageTaken(finalDamage);
return finalDamage;
}
}