Add new meta files and interfaces for project structure

This commit is contained in:
2025-07-11 21:46:14 +02:00
commit 43c1730ed5
3230 changed files with 1428743 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using Data;
using Interfaces;
using KBCore.Refs;
using UnityEngine;
namespace Systems
{
public class DeathHandler : MonoBehaviour
{
[Self, SerializeField] private Character character;
[Self, SerializeField] private InterfaceRef<IDeathBehavior> deathBehavior;
private void OnEnable()
{
character.attributes.OnHealthChanged += OnHealthChanged;
}
private void OnDisable()
{
character.attributes.OnHealthChanged -= OnHealthChanged;
}
private void OnHealthChanged(float newHealth)
{
if (newHealth <= 0f)
{
Die();
}
}
private void Die()
{
deathBehavior.Value.Die();
}
}
}