Changing Color of Curser

Ok in my fps game i want it so that way when my player curser goes over a enemy the curser will change to the color green. If it hovers over a enemy it will turn red letting your know to kill that player. And when your shooting and the bullet hits the target the curser will change from its orginal start to a X letting you know you are hitting the target!

Here is my idea for the script i would use for changing curser colors.

private var N_curser = true;
private var R_curser = false;
private var G_cureser = false;

function Awake ()
{
    N_curser.enabled = true;
    R_curser.enabled = false;
    G_curser.enabled = false;

}

function OnMouseEnter ()
{
    if ( gameObject.tag == "enemy" )
    {
         N_curser.enabled = false;
         R_curser.enabled = true;
         G_curser.enabled = false;
    }

    else if ( gameObject.tag == "friend" )
    {
         N_curser.enabled = false;
         R_curser.enabled = false;
         G_curser.enabled = true;
    }

}

function OnMouseExit ()
{
    N_curser.enabled = true;
    R_curser.enabled = false;
    G_curser.enabled = false;

}

I then got no clue on how to make the curser change its shape when you hit the target but i probably can do it if i wasnt hitting it though. Would the script above work?

The idea of using custom cursor is hide the cursor and render your own cursor texture and update the position to where your mouse is pointing each frame.

Hide your cursor by:

Screen.showCursor = false;

Example:

var t_Ray_02 : Ray = Camera_Reference.v_MouseCamera.ScreenPointToRay(Input.mousePosition);
			var t_Hit_02 : RaycastHit;
			
			if(Physics.Raycast(t_Ray_02, t_Hit_02, 100.0))
			{
				switch(t_Hit_02.collider.gameObject.name)
				{
					case "- Enemy" :
					renderer.material.color = Color.red;
					break;
					
					case "- Friend" :
					renderer.material.color = Color.red;
					break;
					
					default :
					renderer.material.color = Color.white;
					break;
				}
			}

This is taken out of context, you have to change the camera refreence to main camera or whatever you use, this basicly just casts a ray from your view and checks against what it hits, then changes colour on a gameobject at the position of the cursor.

Furthermore, you can use camera render depth to get the mouse objects to appear ontop always.