Added simple death mechanic

This commit is contained in:
Stedd 2024-10-05 16:45:27 +02:00
parent 4005878930
commit c81a750f2f
1 changed files with 4 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Events;
namespace GameDev.CoreSystems
{
@ -14,6 +15,8 @@ namespace GameDev.CoreSystems
[field: Header("Modifiers")]
[field: SerializeField] public bool IsInvulnerable { get; private set; }
public UnityEvent DeathEvent;
private void OnEnable()
{
_activeDamageableRuntimeSet.Add(this);
@ -35,6 +38,7 @@ namespace GameDev.CoreSystems
if (CurrentHealth >= 0) return;
print($"{transform.parent.parent.name} died");
DeathEvent.Invoke();
}
#endregion