Check if position is inside area?

Hey guys, I am trying to make a more realistic visual cone for my AI. I think Ive got a reasonable system set up. But I am not sure how I can check if my player is inside the green area (see picture)!

If I know wheter or not the player is inside the green area, the rest is easy to find out!

Here is the code I am using inside OnTriggerStay to find the position of the player and the positions of the cone:

Vector3 dir = o.transform.position - head.position;
			float a = Vector3.Angle(dir, transform.forward);
			float d = Vector3.Distance(o.transform.position, head.position);

#region Sweetspot Debug
			byte fov = (byte)120f;																	//TODO Make dynamic based on rendertextures cameras fov
			float ssmp = 0f;																			
//			float y = 0f;																			//TODO Store
			float r1 = 10;																			//TODO Make public
			float r2 = 16;																			//TODO Make public
			float r3 = 20;																			//TODO Make public

			float x = r3*Mathf.Sin(Mathf.Deg2Rad*(fov/6))/Mathf.Sin(Mathf.Deg2Rad*(180-(fov/3)));
			Debug.Log(x);

			Debug.DrawRay(transform.position, transform.right*r1, Color.red);
			Debug.DrawRay(transform.position, -transform.right*r1, Color.red);

			Ray ray0 = new Ray(transform.position, transform.right+transform.forward*Mathf.Rad2Deg/(fov/3));
			Ray ray1 = new Ray(transform.position, -transform.right+transform.forward*Mathf.Rad2Deg/(fov/3));
			Debug.DrawRay(transform.position, ray0.direction*r3, Color.cyan);
			Debug.DrawRay(transform.position, ray1.direction*r3, Color.cyan);

			Debug.DrawRay(transform.position, ray0.direction*x, Color.green);
			Debug.DrawRay(transform.position, ray1.direction*x, Color.green);

			Ray ray4 = new Ray(transform.position, (transform.right/4+transform.forward));
			Ray ray5 = new Ray(transform.position, (-transform.right/4+transform.forward));

			Ray ray2 = new Ray(transform.position, transform.right+transform.forward*Mathf.Rad2Deg/(fov/2));
			Ray ray3 = new Ray(transform.position, -transform.right+transform.forward*Mathf.Rad2Deg/(fov/2));
			Debug.DrawRay(transform.position, ray2.direction*r2, Color.yellow);
			Debug.DrawRay(transform.position, ray3.direction*r2, Color.yellow);

			#region Draw lines
			Debug.DrawRay(transform.position, transform.forward*r3, Color.blue);
			Debug.DrawRay(transform.position, transform.forward*r2, Color.yellow);
			Debug.DrawRay(transform.position, transform.forward*r1, Color.red);

			Debug.DrawLine(transform.right*r1, ray2.direction*r1, Color.red);
			Debug.DrawLine(-transform.right*r1, ray3.direction*r1, Color.red);
			Debug.DrawLine(ray2.direction*r1, ray4.direction*r1, Color.red);
			Debug.DrawLine(ray3.direction*r1, ray5.direction*r1, Color.red);
			Debug.DrawLine(ray4.direction*r1, transform.forward*r1, Color.red);
			Debug.DrawLine(ray5.direction*r1, transform.forward*r1, Color.red);

			Debug.DrawLine(ray2.direction*r2, ray4.direction*r2, Color.yellow);
			Debug.DrawLine(ray3.direction*r2, ray5.direction*r2, Color.yellow);
			Debug.DrawLine(ray4.direction*r2, transform.forward*r2, Color.yellow);
			Debug.DrawLine(ray5.direction*r2, transform.forward*r2, Color.yellow);

			Debug.DrawLine(ray0.direction*r3, ray4.direction*r3, Color.blue);
			Debug.DrawLine(ray1.direction*r3, ray5.direction*r3, Color.blue);
			Debug.DrawLine(ray4.direction*r3, transform.forward*r3, Color.blue);
			Debug.DrawLine(ray5.direction*r3, transform.forward*r3, Color.blue);

			Debug.DrawLine(ray4.direction*r3, ray0.direction*x, Color.green);
			Debug.DrawLine(ray5.direction*r3, ray1.direction*x, Color.green);
			#endregion

			#endregion

Create an empty gameObject and make it the child of the AI user.

Put a reference to it in your script with ‘public GameObject backWardsCone’.

make a narrower cone from that backWardsCone.transform.position toward the Ai User.

Check to see if the player is in both of these cones, the red one and the backward one.

This is a pretty brute force way of doing what you would like, it may not have the flare you are looking for.

You can divide your green zone in 3 triangles for example:

triangle 1
transform.position
 ray0.direction*x
 ray1.direction*x
trangle 2
ray0.direction*x
ray4.direction*r3
ray1.direction*x
triangle 3
ray1.direction*x
ray4.direction*r3
ray5.direction*r3

after that it should be easy there is already a lot of threads that cover the test of a point inside a triangle.
This is a copy-paste from an answer found on the web ( thanks to Kornel Kisielewicz) :

float sign (fPoint p1, fPoint p2, fPoint p3)
{
    return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
}

bool PointInTriangle (fPoint pt, fPoint v1, fPoint v2, fPoint v3)
{
    bool b1, b2, b3;

    b1 = sign(pt, v1, v2) < 0.0f;
    b2 = sign(pt, v2, v3) < 0.0f;
    b3 = sign(pt, v3, v1) < 0.0f;

    return ((b1 == b2) && (b2 == b3));
}