mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-30 00:48:00 +01:00
30 lines
889 B
C#
30 lines
889 B
C#
|
using UnityEngine;
|
||
|
using UnityEngine.AI;
|
||
|
|
||
|
namespace CinemaDirector
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// An event for setting a navigation destination.
|
||
|
/// Only executes in runtime. Not reversable.
|
||
|
/// </summary>
|
||
|
[CutsceneItemAttribute("Navigation", "Set Destination", CutsceneItemGenre.ActorItem)]
|
||
|
public class SetDestinationEvent : CinemaActorEvent
|
||
|
{
|
||
|
// The destination target
|
||
|
public Vector3 target;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Trigger this event and set a new destination.
|
||
|
/// </summary>
|
||
|
/// <param name="actor">The actor with a NavMeshAgent to set a new destination for.</param>
|
||
|
public override void Trigger(GameObject actor)
|
||
|
{
|
||
|
NavMeshAgent agent = actor.GetComponent<NavMeshAgent>();
|
||
|
if (agent != null)
|
||
|
{
|
||
|
agent.SetDestination(target);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|