The perspective sense will detect whether a specific aspect is within its field of view and visible distance. If it sees anything, it will take the specified action, which in this case is to print a message to the console.
The code in the Perspective.cs file looks like this:
using UnityEngine;
public class Perspective : Sense
{
public int fieldOfView = 45;
public int viewDistance = 100;
private Transform playerTransform;
private Vector3 rayDirection;
protected override void Initialize()
{
playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
}
protected override void UpdateSense()
{
elapsedTime += Time.deltaTime;
if (elapsedTime >= detectionRate)
{
DetectAspect();
}
}
//Detect perspective field of view for the AI Character
void DetectAspect...