InfiniteRuntimeClip.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using UnityEngine.Playables;
  3. namespace UnityEngine.Timeline
  4. {
  5. /// <summary>
  6. /// Runtime clip customized for 'infinite' tracks playables.
  7. /// Used for clips whose time needs to match the timelines exactly
  8. /// </summary>
  9. class InfiniteRuntimeClip : RuntimeElement
  10. {
  11. private Playable m_Playable;
  12. private static readonly Int64 kIntervalEnd = DiscreteTime.GetNearestTick(TimelineClip.kMaxTimeValue);
  13. public InfiniteRuntimeClip(Playable playable)
  14. {
  15. m_Playable = playable;
  16. }
  17. public override Int64 intervalStart
  18. {
  19. get { return 0; }
  20. }
  21. public override Int64 intervalEnd
  22. {
  23. get { return kIntervalEnd; }
  24. }
  25. public override bool enable
  26. {
  27. set
  28. {
  29. if (value)
  30. m_Playable.Play();
  31. else
  32. m_Playable.Pause();
  33. }
  34. }
  35. public override void EvaluateAt(double localTime, FrameData frameData)
  36. {
  37. m_Playable.SetTime(localTime);
  38. }
  39. }
  40. }