identify what gameobject hitting player with raycast

I know how to do the reverse, identify what game object the player is hitting.But how do i get the name of the enemy shooting me? It all goes to whether or not I am being fired upon. If I am, then my unarmed companion takes cover, when I kill the threat ( whoever was shooting at me/us) my companion comes out of hiding. Enemies spawn randomly so i can’t hardwire in code saying if(so and so) is dead. I need the name of the particular enemy threat, and once I get his name…plug it into the ifDead statement to get my cowering friend out from behind the rocks

easier than I thought. in the gun script for each enemy, in addition to

  hit.transform.SendMessage ("HitByRay");

also send the name of the shooter

hit.transform.SendMessage ("BadGuy1");

and a script on the player with a list of possible shooters and void for each

using UnityEngine;
using System.Collections;

public class testGetNameRayHit : MonoBehaviour {
	public GameObject [] shooterList;
	public GameObject shooter = null;
	public bool shot;
	void Start () {
	}
	void HitByRay(){
		shot = true;
	}
	void BadGuy1 () {
		shooter = shooterList[0];
	}
	void BadGuy2 () {
		shooter = shooterList[1];
	}
	void BadGuy3 () {
		shooter = shooterList[2];
	}
}

probably a better way to do it but this works