private void Update() { float currentTime = Time.time; if (currentTime >= _nextAttackTime) { Vector3 targetPosition = target.position; float _distanceDifference = Vector3.Distance(targetPosition, transform.position); if (_distanceDifference <= _attackDistance) { characterHealth.TakeDamage(_damage); _nextAttackTime = currentTime + _attackDelay; _mobAnimation.Attack(); _mobSound.MobAttack_Sound(); } } }