broken composition and signals

This commit is contained in:
2026-01-17 17:02:31 +01:00
parent 0436053c62
commit 4ccdbc0ee6
22 changed files with 302 additions and 36 deletions

View File

@@ -1,8 +1,9 @@
using Godot;
using System;
namespace Movementtests.interfaces;
public interface IDamageable
{
void TakeDamage(RDamage damage);
event Action<float> DamageTaken;
float TakeDamage(RDamage damage);
}

View File

@@ -1,7 +1,6 @@
namespace Movementtests.interfaces;
public interface IKillable
public interface IHealthable
{
float CurrentHealth { get; set; }
void ReduceHealth(float amount);
}

View File

@@ -1,7 +1,6 @@
namespace Movementtests.interfaces;
public interface IHealthable
public interface IKillable
{
float CurrentHealth { get; set; }
void ReduceHealth(float amount);
void Kill();
}

View File

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

View File

@@ -9,4 +9,8 @@ public static class NodeExtensions
{
return nodes == null ? System.Array.Empty<IDamageable>() : nodes.OfType<IDamageable>().ToArray();
}
public static IKillable[] ToIKillables(this GodotObject[] nodes)
{
return nodes == null ? System.Array.Empty<IKillable>() : nodes.OfType<IKillable>().ToArray();
}
}