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.
The code in the Perspective.cs
file can be shown as follows:
using UnityEngine; using System.Collections; public class Perspective : Sense { public int FieldOfView = 45; public int ViewDistance = 100; private Transform playerTrans; private Vector3 rayDirection; protected override void Initialize() { //Find player position playerTrans = GameObject.FindGameObjectWithTag("Player").transform; } // Update is called once per frame protected override void UpdateSense() { elapsedTime += Time.deltaTime; // Detect perspective sense if within the detection rate if (elapsedTime >= detectionRate) DetectAspect(); } //Detect perspective field of view for the AI Character void DetectAspect() { RaycastHit hit; //Direction from current position to...