using UnityEngine; public class EnemyAttack : MonoBehaviour { [Header("Attack Settings")] [SerializeField] private float damage = 10f; [SerializeField] private float attackCooldown = 1.0f; // 공격 간격 (1초) private float _nextAttackTime = 0f; // EnemyAttack.cs private void OnCollisionStay(Collision collision) { if (Time.time >= _nextAttackTime) { // 상대방에게서 IDamageable 인터페이스가 있는지 확인 IDamageable target = collision.gameObject.GetComponent(); if (target != null) { target.TakeDamage(damage); _nextAttackTime = Time.time + attackCooldown; } } } }