removed obsolete interfaces for health and damage
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 27s
Create tag and build when new code gets to main / Export (push) Successful in 5m25s

This commit is contained in:
2026-05-05 11:51:35 +02:00
parent 33f55d04f3
commit 68e36742af
41 changed files with 37 additions and 703 deletions

View File

@@ -1,35 +0,0 @@
using Godot;
using System;
using Movementtests.interfaces;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_heart.png")]
public partial class CHealth : Node, IHealthable
{
public event Action<IHealthable, HealthChangedRecord> HealthChanged = null!;
public event Action<IHealthable> HealthDepleted = null!;
[Export]
public RHealth RHealth { get; set; } = null!;
public float CurrentHealth { get; set; }
public override void _Ready()
{
CurrentHealth = RHealth.StartingHealth;
}
public HealthChangedRecord ReduceHealth(IDamageable source, DamageRecord damageRecord)
{
var previousHealth = CurrentHealth;
CurrentHealth -= damageRecord.Damage.DamageDealt;
var record = new HealthChangedRecord(CurrentHealth, previousHealth, RHealth.StartingHealth);
HealthChanged?.Invoke(this, record);
if (CurrentHealth <= 0)
{
CurrentHealth = 0;
HealthDepleted?.Invoke(this);
}
return record;
}
}

View File

@@ -1 +0,0 @@
uid://bjwrpv3jpsc1e

View File

@@ -1,6 +0,0 @@
[gd_scene format=3 uid="uid://c4ikbhojckpnc"]
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://scenes/components/health/CHealth.cs" id="1_75uyt"]
[node name="CHealth" type="Node" unique_id=1940090217]
script = ExtResource("1_75uyt")

View File

@@ -5,8 +5,8 @@ using Movementtests.interfaces;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_thunder.png")]
public partial class RDeathEffect : Resource, IKillable
{
public void Kill(IHealthable source)
public void Kill()
{
GD.Print($"Death Effect triggered on {source}");
GD.Print($"Death Effect triggered");
}
}

View File

@@ -1,12 +0,0 @@
using Godot;
using System;
using Movementtests.interfaces;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_heart.png")]
public partial class RHealth(float startingHealth) : Resource
{
[Export]
public float StartingHealth { get; set;} = startingHealth;
public RHealth() : this(100.0f) {}
}

View File

@@ -1 +0,0 @@
uid://baiapod3csndf