simple ai pls help

Hello, I’m a fairly beginner coder and id like to make a very simple ai script. Lets imagine the ai is a turret(well it is) now with unity we add somekinda fov bubble around it so it could see. Now what i want to do is when a player enters that fov bubble the turret will shoot and rotate to keep shooting the player until its out of its fov bubble or rotate depending on the turrets position to shoot the player as in the first example. I dont want the turret to be rotating when the enemy isnt near no patrolling. i just want the turret to know when the player enters the fov area and then the turret will rotate or shoot as in the previous 2 examples.

Any help?

First you have to do something to detect the player entering the fov bubble.
You may attach a collider to the player and the fov bubble.
Or you may determine the x-y co-ordinates of the fov bubble and check whether the player’s co-ordinate is under the fov bubble or not. (in this case the collider might be a more viable solution).
Then you can set up a simple if-else system such that the turret fires at the player’s co-ordinates as soon as the condition of player going inside the range of turret is fulfilled.