Added simple death mechanic

This commit is contained in:
Stedd 2024-10-05 16:45:27 +02:00
parent 369c32fe71
commit bb89431807
2 changed files with 7 additions and 2 deletions

@ -1 +1 @@
Subproject commit 4005878930047e686a5efbd876ebee4cb3d97442
Subproject commit c81a750f2fd89f8ba79c098c353f100e0925637f

View File

@ -1,4 +1,3 @@
using AsteroidGame.ScriptableObjects;
using GameDev.CoreSystems;
using UnityEngine;
@ -33,6 +32,12 @@ namespace AsteroidGame.Entities
private void InitializeDamageable()
{
Damageable ??= gameObject.AddComponent<Damageable>();
Damageable.DeathEvent.AddListener(HandleDeath);
}
private void HandleDeath()
{
Destroy(gameObject);
}
private void InitializeTargetable()