IUpdatable.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Animancer // https://kybernetik.com.au/animancer // Copyright 2022 Kybernetik //
  2. using UnityEngine;
  3. namespace Animancer
  4. {
  5. /// <summary>[Pro-Only] An object that can be updated during Animancer's animation updates.</summary>
  6. ///
  7. /// <example>
  8. /// Register to receive updates using <see cref="AnimancerPlayable.RequirePreUpdate"/> or
  9. /// <see cref="AnimancerPlayable.RequirePostUpdate"/> and stop
  10. /// receiving updates using <see cref="AnimancerPlayable.CancelPreUpdate"/> or
  11. /// <see cref="AnimancerPlayable.CancelPostUpdate"/>.
  12. /// <para></para><code>
  13. /// public sealed class MyUpdatable : Key, IUpdatable
  14. /// {
  15. /// private AnimancerComponent _Animancer;
  16. ///
  17. /// public void StartUpdating(AnimancerComponent animancer)
  18. /// {
  19. /// _Animancer = animancer;
  20. ///
  21. /// // If you want Update to be called before the playables get updated.
  22. /// _Animancer.Playable.RequirePreUpdate(this);
  23. ///
  24. /// // If you want Update to be called after the playables get updated.
  25. /// _Animancer.Playable.RequirePostUpdate(this);
  26. /// }
  27. ///
  28. /// public void StopUpdating()
  29. /// {
  30. /// // If you used RequirePreUpdate.
  31. /// _Animancer.Playable.CancelPreUpdate(this);
  32. ///
  33. /// // If you used RequirePostUpdate.
  34. /// _Animancer.Playable.CancelPostUpdate(this);
  35. /// }
  36. ///
  37. /// void IUpdatable.Update()
  38. /// {
  39. /// // Called during every animation update.
  40. ///
  41. /// // AnimancerPlayable.Current can be used to access the system it is being updated by.
  42. /// }
  43. /// }
  44. /// </code></example>
  45. ///
  46. /// https://kybernetik.com.au/animancer/api/Animancer/IUpdatable
  47. ///
  48. public interface IUpdatable : Key.IListItem
  49. {
  50. /************************************************************************************************************************/
  51. /// <summary>Called during every <see cref="Animator"/> update.</summary>
  52. /// <remarks>The <see cref="Animator.updateMode"/> determines the update rate.</remarks>
  53. void Update();
  54. /************************************************************************************************************************/
  55. }
  56. }