removed obsolete interfaces for health and damage
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bjwrpv3jpsc1e
|
||||
@@ -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")
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://baiapod3csndf
|
||||
Reference in New Issue
Block a user