MotionScheduler.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. namespace LitMotion
  2. {
  3. /// <summary>
  4. /// Schedulers available in Runtime.
  5. /// </summary>
  6. public static class MotionScheduler
  7. {
  8. static MotionScheduler()
  9. {
  10. DefaultScheduler = Update;
  11. }
  12. /// <summary>
  13. /// Default scheduler used if not specified
  14. /// </summary>
  15. public static IMotionScheduler DefaultScheduler { get; set; }
  16. /// <summary>
  17. /// Scheduler that updates motion at Initialization.
  18. /// </summary>
  19. public static readonly IMotionScheduler Initialization = new PlayerLoopMotionScheduler(PlayerLoopTiming.Initialization, MotionTimeKind.Time);
  20. /// <summary>
  21. /// Scheduler that updates motion at Initialization. (Ignore timescale)
  22. /// </summary>
  23. public static readonly IMotionScheduler InitializationIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.Initialization, MotionTimeKind.UnscaledTime);
  24. /// <summary>
  25. /// Scheduler that updates motion at Initialization. (Realtime)
  26. /// </summary>
  27. public static readonly IMotionScheduler InitializationRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.Initialization, MotionTimeKind.Realtime);
  28. /// <summary>
  29. /// Scheduler that updates motion at EarlyUpdate.
  30. /// </summary>
  31. public static readonly IMotionScheduler EarlyUpdate = new PlayerLoopMotionScheduler(PlayerLoopTiming.EarlyUpdate, MotionTimeKind.Time);
  32. /// <summary>
  33. /// Scheduler that updates motion at EarlyUpdate. (Ignore timescale)
  34. /// </summary>
  35. public static readonly IMotionScheduler EarlyUpdateIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.EarlyUpdate, MotionTimeKind.UnscaledTime);
  36. /// <summary>
  37. /// Scheduler that updates motion at EarlyUpdate. (Realtime)
  38. /// </summary>
  39. public static readonly IMotionScheduler EarlyUpdateRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.EarlyUpdate, MotionTimeKind.Realtime);
  40. /// <summary>
  41. /// Scheduler that updates motion at FixedUpdate.
  42. /// </summary>
  43. public static readonly IMotionScheduler FixedUpdate = new PlayerLoopMotionScheduler(PlayerLoopTiming.FixedUpdate, MotionTimeKind.Time);
  44. /// <summary>
  45. /// Scheduler that updates motion at PreUpdate.
  46. /// </summary>
  47. public static readonly IMotionScheduler PreUpdate = new PlayerLoopMotionScheduler(PlayerLoopTiming.PreUpdate, MotionTimeKind.Time);
  48. /// <summary>
  49. /// Scheduler that updates motion at PreUpdate. (Ignore timescale)
  50. /// </summary>
  51. public static readonly IMotionScheduler PreUpdateIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.PreUpdate, MotionTimeKind.UnscaledTime);
  52. /// <summary>
  53. /// Scheduler that updates motion at PreUpdate. (Realtime)
  54. /// </summary>
  55. public static readonly IMotionScheduler PreUpdateRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.PreUpdate, MotionTimeKind.Realtime);
  56. /// <summary>
  57. /// Scheduler that updates motion at Update.
  58. /// </summary>
  59. public static readonly IMotionScheduler Update = new PlayerLoopMotionScheduler(PlayerLoopTiming.Update, MotionTimeKind.Time);
  60. /// <summary>
  61. /// Scheduler that updates motion at Update. (Ignore timescale)
  62. /// </summary>
  63. public static readonly IMotionScheduler UpdateIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.Update, MotionTimeKind.UnscaledTime);
  64. /// <summary>
  65. /// Scheduler that updates motion at Update. (Realtime)
  66. /// </summary>
  67. public static readonly IMotionScheduler UpdateRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.Update, MotionTimeKind.Realtime);
  68. /// <summary>
  69. /// Scheduler that updates motion at PreLateUpdate.
  70. /// </summary>
  71. public static readonly IMotionScheduler PreLateUpdate = new PlayerLoopMotionScheduler(PlayerLoopTiming.PreLateUpdate, MotionTimeKind.Time);
  72. /// <summary>
  73. /// Scheduler that updates motion at PreLateUpdate. (Ignore timescale)
  74. /// </summary>
  75. public static readonly IMotionScheduler PreLateUpdateIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.PreLateUpdate, MotionTimeKind.UnscaledTime);
  76. /// <summary>
  77. /// Scheduler that updates motion at PreLateUpdate. (Realtime)
  78. /// </summary>
  79. public static readonly IMotionScheduler PreLateUpdateRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.PreLateUpdate, MotionTimeKind.Realtime);
  80. /// <summary>
  81. /// Scheduler that updates motion at PostLateUpdate.
  82. /// </summary>
  83. public static readonly IMotionScheduler PostLateUpdate = new PlayerLoopMotionScheduler(PlayerLoopTiming.PostLateUpdate, MotionTimeKind.Time);
  84. /// <summary>
  85. /// Scheduler that updates motion at PostLateUpdate. (Ignore timescale)
  86. /// </summary>
  87. public static readonly IMotionScheduler PostLateUpdateIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.PostLateUpdate, MotionTimeKind.UnscaledTime);
  88. /// <summary>
  89. /// Scheduler that updates motion at PostLateUpdate. (Realtime)
  90. /// </summary>
  91. public static readonly IMotionScheduler PostLateUpdateRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.PostLateUpdate, MotionTimeKind.Realtime);
  92. /// <summary>
  93. /// Scheduler that updates motion at TimeUpdate.
  94. /// </summary>
  95. public static readonly IMotionScheduler TimeUpdate = new PlayerLoopMotionScheduler(PlayerLoopTiming.TimeUpdate, MotionTimeKind.Time);
  96. /// <summary>
  97. /// Scheduler that updates motion at TimeUpdate. (Ignore timescale)
  98. /// </summary>
  99. public static readonly IMotionScheduler TimeUpdateIgnoreTimeScale = new PlayerLoopMotionScheduler(PlayerLoopTiming.TimeUpdate, MotionTimeKind.UnscaledTime);
  100. /// <summary>
  101. /// Scheduler that updates motion at TimeUpdate. (Realtime)
  102. /// </summary>
  103. public static readonly IMotionScheduler TimeUpdateRealtime = new PlayerLoopMotionScheduler(PlayerLoopTiming.TimeUpdate, MotionTimeKind.Realtime);
  104. /// <summary>
  105. /// Scheduler that updates motion with `ManualMotionDispatcher.Update()`
  106. /// </summary>
  107. public static readonly IMotionScheduler Manual = new ManualMotionScheduler();
  108. }
  109. }