using UnityEngine; /// /// Trigger volume placed in exit rooms to detect when agents reach the goal. /// When an agent enters the trigger, it calls StopAtGoal() to stop movement and mark as exited. /// public class ExitRoomTrigger : MonoBehaviour { private void OnTriggerEnter(Collider other) { // Check if the entering object is an agent AIAgent agent = other.GetComponent(); if (agent != null && !agent.HasReachedGoal) { agent.StopAtGoal(); } } }