using UnityEngine; using UnityEngine.AI; namespace CinemaDirector { /// /// An event for setting a navigation destination. /// Only executes in runtime. Not reversable. /// [CutsceneItemAttribute("Navigation", "Set Destination", CutsceneItemGenre.ActorItem)] public class SetDestinationEvent : CinemaActorEvent { // The destination target public Vector3 target; /// /// Trigger this event and set a new destination. /// /// The actor with a NavMeshAgent to set a new destination for. public override void Trigger(GameObject actor) { NavMeshAgent agent = actor.GetComponent(); if (agent != null) { agent.SetDestination(target); } } } }