how to do 2.5D side scroller-Gun point towards mouse then -180 character turn

im really new to the unity programing. Im making a 2.5D game where the character walks around carrying a gun i want the gun to point towards where the mouse is. And then when the mouse goes behind the player i want to player to turn and be facing the mouse again. I have tried a lot of things but i really dont know even where to put the code. So if you have an answer for me could you tell me also how to set it up and where to put the code. Thanks very much.

I believe what you is to cast a ray from the gun and let the mouse follow the ray. When the mouse moves, the chest bone moves on the y axis that is x axis, and if the mouse x is less than 0 0 coordinates on the screen the character turns around.