Added simple death mechanic
This commit is contained in:
parent
369c32fe71
commit
bb89431807
|
@ -1 +1 @@
|
||||||
Subproject commit 4005878930047e686a5efbd876ebee4cb3d97442
|
Subproject commit c81a750f2fd89f8ba79c098c353f100e0925637f
|
|
@ -1,4 +1,3 @@
|
||||||
using AsteroidGame.ScriptableObjects;
|
|
||||||
using GameDev.CoreSystems;
|
using GameDev.CoreSystems;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
@ -33,6 +32,12 @@ namespace AsteroidGame.Entities
|
||||||
private void InitializeDamageable()
|
private void InitializeDamageable()
|
||||||
{
|
{
|
||||||
Damageable ??= gameObject.AddComponent<Damageable>();
|
Damageable ??= gameObject.AddComponent<Damageable>();
|
||||||
|
Damageable.DeathEvent.AddListener(HandleDeath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleDeath()
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeTargetable()
|
private void InitializeTargetable()
|
||||||
|
|
Loading…
Reference in New Issue