NavMeshAgentControlClip.cs 809 B

12345678910111213141516171819202122232425
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.Playables;
  4. using UnityEngine.Timeline;
  5. [Serializable]
  6. public class NavMeshAgentControlClip : PlayableAsset, ITimelineClipAsset
  7. {
  8. public ExposedReference<Transform> destination;
  9. [HideInInspector]
  10. public NavMeshAgentControlBehaviour template = new NavMeshAgentControlBehaviour ();
  11. public ClipCaps clipCaps
  12. {
  13. get { return ClipCaps.None; }
  14. }
  15. public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
  16. {
  17. var playable = ScriptPlayable<NavMeshAgentControlBehaviour>.Create (graph, template);
  18. NavMeshAgentControlBehaviour clone = playable.GetBehaviour ();
  19. clone.destination = destination.Resolve (graph.GetResolver ());
  20. return playable;
  21. }
  22. }