This commit is contained in:
Alex38Lyon
2025-06-03 12:00:47 +02:00
parent ed8041abcd
commit 878ea46cac
1300 changed files with 527178 additions and 0 deletions
@@ -0,0 +1,30 @@
using UnityEngine;
namespace Unity.FPS.Game
{
public class Destructable : MonoBehaviour
{
Health m_Health;
void Start()
{
m_Health = GetComponent<Health>();
DebugUtility.HandleErrorIfNullGetComponent<Health, Destructable>(m_Health, this, gameObject);
// Subscribe to damage & death actions
m_Health.OnDie += OnDie;
m_Health.OnDamaged += OnDamaged;
}
void OnDamaged(float damage, GameObject damageSource)
{
// TODO: damage reaction
}
void OnDie()
{
// this will call the OnDestroy function
Destroy(gameObject);
}
}
}