using KitsuneCafe.System; using UnityEngine; namespace KitsuneCafe.Entity { public interface IDamaging : IGameObject { void ApplyDamage(int amount, IDamageable target); } public interface IDamageable : IGameObject { void ReceiveDamage(IDamaging source, int amount); } public class DamageSource : MonoBehaviour, IDamaging { [SerializeField] private int damage; public void ApplyDamage(int amount, IDamageable target) { target.ReceiveDamage(this, amount); } public void ApplyDamage(int amount, GameObject target) { if (target.TryGetComponent(out IDamageable damageable)) { ApplyDamage(amount, damageable); } } } }