Projext/Assets/Scripts/Combat/Debug/DamageBot.cs
2026-02-02 17:30:23 +09:00

14 lines
437 B
C#

using UnityEngine;
public class DamageBot : MonoBehaviour
{
[SerializeField] private float damageAmount = 10f, damageInterval = 1.0f;
private float timer;
private void OnTriggerStay(Collider other)
{
if (other.TryGetComponent<IDamageable>(out var target))
{
timer += Time.deltaTime;
if (timer >= damageInterval) { target.TakeDamage(damageAmount); timer = 0f; }
}
}
}