Check out example codes for "unity 2d enemy field of view". It will help you in understanding the concepts better.

Code Example 1

if (Vector3.Distance(playerPosition, EnemyPosition) < 22.5)
 {
   Debug.Log("I'm seeing the player");
 }

Learn ReactJs, React Native from akashmittal.com