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(out var target)) { timer += Time.deltaTime; if (timer >= damageInterval) { target.TakeDamage(damageAmount); timer = 0f; } } } }