Sense

The Sense class is the interface of our sensory system that the other custom senses can implement. It defines two virtual methods, Initialize and UpdateSense, which are executed from the Start and Update methods, respectively, and which we can override when implementing custom senses.

Here, we are showing the code that's in the Sense.cs file:

using UnityEngine; public class Sense : MonoBehaviour { public bool bDebug = true; public Aspect.aspect aspectName = Aspect.aspect.Enemy; public float detectionRate = 1.0f; protected float elapsedTime = 0.0f; protected virtual void Initialize() { } protected virtual void UpdateSense() { } // Use this for initialization void Start () { elapsedTime = 0.0f; Initialize(); } // Update is called once ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.