Here is a bit explanation how the perception system code works.
Basic features of the code is as follows
- If the player object is behind some other object, it is not seen. This is tested with Physics.Linecast from the center of perceiving object to the center of the player object.
- If player object is really near (distance < closeRange), the player object is noticed 360 arc.
- If the player object is fron (angle between the forward vector of perceiving game object and the player object is less than front angle) and distance is less than frontDistance, the player object is seen.