enemy only shoot when player in sight

im new to ray-casting and don't really know how it works? could someone send me a link.

http://answers.unity3d.com/questions/tagged/line-of-sight