Added basic features

This commit is contained in:
2025-05-08 09:24:43 +09:00
parent 4acffb32e4
commit bee969f7ef
131 changed files with 69136 additions and 109 deletions

28
Assets/Scripts/Health.cs Normal file
View File

@@ -0,0 +1,28 @@
using UnityEngine;
public class Health : MonoBehaviour, IDamageable
{
private float _currentHealth;
[SerializeField]
private float _maxHealth = 100.0f;
public event DamageEventHandler OnDamageTaken;
private void Awake()
{
_currentHealth = _maxHealth;
}
public void Damage(float damageAmount)
{
var oldHealth = _currentHealth;
_currentHealth -= damageAmount;
OnDamageTaken?.Invoke(new DamageData
{
oldHealth = oldHealth,
newHealth = _currentHealth,
damageAmount = damageAmount
});
}
}