TransformTweenClip.cs 877 B

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