trying to get object to shoot only if he's pointing at player. Need Help.

I have this enemy the rotates around in a circle, and I want him to fire at the player only when he’s directly pointed at him.
But I’m having a hard time getting the target angle that the enemy needs to fire at. Here’s the code I have that’s trying to
get the angle between the enemy and the player:

GameObject player = GameObject.FindGameObjectWithTag ("Player");
		Vector3 playerPos = player.transform.position;
		Quaternion targetRotation = Quaternion.LookRotation (Vector3.forward, playerPos - transform.position);

It compiles right, but it doesn’t seem to shoot at the right spot. And it doesn’t always shoot every full rotation.
Any help would be greatly appreciated.

try

float shootingangle = 5
if  ( Vector3.Angle(player.transform.forward, transform.position - player.transform.position) < shootingangle ) {
 
}

Would it be better to use a raycast?

This is Unity’s raycasting tutorial. It helped me out a lot.