2d tower defence

I am currently working on a pvz type game and I need help with the tower ai. I want the tower to be able to detect enemies that are in front of it.

Raycasting and trigger colliders are a couple ways to accomplish this.