How to create Turret AI in C#

How to create Turret AI in C#, that will fire on the player when it’s in shooting range?

Brackeys has a tutorial series on a tower defense game. I believe this is the link to the video where he does turret AI.

The answer is as open ended as the question! I would make use of Physics.Raycast to check if the player is in line of sight, but only cast if the distance is your firing distance. You could then use the Ray to determine if the turret pivots, fires, or re-scans for another target!