ok so this should be the way to go
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 20s
Create tag and build when new code gets to main / Export (push) Successful in 10m24s

This commit is contained in:
2026-01-17 21:51:57 +01:00
parent 7c74b8b5e5
commit 561e026834
14 changed files with 64 additions and 35 deletions

View File

@@ -5,10 +5,8 @@ using Movementtests.interfaces;
[GlobalClass]
public partial class CHealth : Node, IHealthable
{
[Signal]
public delegate void HealthChangedEventHandler(float health);
[Signal]
public delegate void DeadEventHandler();
public event Action<IHealthable, float> HealthChanged;
public event Action<IHealthable> HealthDepleted;
[Export]
public RHealth HealthResource;
@@ -20,15 +18,15 @@ public partial class CHealth : Node, IHealthable
CurrentHealth = HealthResource.StartingHealth;
}
public void ReduceHealth(float amount)
public void ReduceHealth(IDamageable source, float amount)
{
CurrentHealth -= amount;
EmitSignalHealthChanged(CurrentHealth);
HealthChanged?.Invoke(this, CurrentHealth);
if (CurrentHealth <= 0)
{
CurrentHealth = 0;
EmitSignalDead();
HealthDepleted?.Invoke(this);
}
}
}