private IEnumerator Shoot() { while (true) { var enemy = _enemiesManager.GetNearestEnemy(_position, _fireRange); if (enemy == null) { yield return(new WaitForEndOfFrame()); continue; } enemy.GetDamage(_shootPower); yield return(new WaitForSeconds(_fireRate)); } }