12 lines
344 B
C#

using System;
using UnityEngine;
[RequireComponent (typeof(Collider))]
public class Hitbox : MonoBehaviour
{
public GameObject Owner { get; private set; }
public event Action<float> OnDamage;
public void Initialize(GameObject Owner) => this.Owner = Owner;
public void TakeDamage(float damage) => OnDamage?.Invoke(damage);
}