IAnimancerComponent.cs 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Animancer // https://kybernetik.com.au/animancer // Copyright 2022 Kybernetik //
  2. using UnityEngine;
  3. namespace Animancer
  4. {
  5. /// <summary>Interface for components that manage an <see cref="AnimancerPlayable"/>.</summary>
  6. /// <remarks>
  7. /// Despite the name, this interface is not necessarily limited to only <see cref="Component"/>s.
  8. /// <para></para>
  9. /// This interface allows Animancer Lite to reference an <see cref="AnimancerComponent"/> inside the pre-compiled
  10. /// DLL while allowing that component to remain outside as a regular script. Otherwise everything would need to be
  11. /// in the DLL which would cause Unity to lose all the script references when upgrading from Animancer Lite to Pro.
  12. /// <para></para>
  13. /// Documentation: <see href="https://kybernetik.com.au/animancer/docs/manual/playing/component-types">Component Types</see>
  14. /// </remarks>
  15. /// https://kybernetik.com.au/animancer/api/Animancer/IAnimancerComponent
  16. ///
  17. public interface IAnimancerComponent
  18. {
  19. /************************************************************************************************************************/
  20. #pragma warning disable IDE1006 // Naming Styles.
  21. /************************************************************************************************************************/
  22. /// <summary>Will this component be updated?</summary>
  23. bool enabled { get; }
  24. /// <summary>The <see cref="GameObject"/> this component is attached to.</summary>
  25. GameObject gameObject { get; }
  26. /************************************************************************************************************************/
  27. #pragma warning restore IDE1006 // Naming Styles.
  28. /************************************************************************************************************************/
  29. /// <summary>The <see cref="UnityEngine.Animator"/> component which this script controls.</summary>
  30. Animator Animator { get; set; }
  31. /// <summary>The internal system which manages the playing animations.</summary>
  32. AnimancerPlayable Playable { get; }
  33. /// <summary>Has the <see cref="Playable"/> been initialized?</summary>
  34. bool IsPlayableInitialized { get; }
  35. /// <summary>Will the object be reset to its original values when disabled?</summary>
  36. bool ResetOnDisable { get; }
  37. /// <summary>
  38. /// Determines when animations are updated and which time source is used. This property is mainly a wrapper
  39. /// around the <see cref="Animator.updateMode"/>.
  40. /// </summary>
  41. AnimatorUpdateMode UpdateMode { get; set; }
  42. /************************************************************************************************************************/
  43. /// <summary>Returns the dictionary key to use for the `clip`.</summary>
  44. object GetKey(AnimationClip clip);
  45. /************************************************************************************************************************/
  46. #if UNITY_EDITOR
  47. /************************************************************************************************************************/
  48. /// <summary>[Editor-Only] The name of the serialized backing field for the <see cref="Animator"/> property.</summary>
  49. string AnimatorFieldName { get; }
  50. /// <summary>[Editor-Only]
  51. /// The name of the serialized backing field for the <see cref="AnimancerComponent.ActionOnDisable"/> property.
  52. /// </summary>
  53. string ActionOnDisableFieldName { get; }
  54. /// <summary>[Editor-Only] The <see cref="UpdateMode"/> that was first used when this script initialized.</summary>
  55. /// <remarks>
  56. /// This is used to give a warning when changing to or from <see cref="AnimatorUpdateMode.AnimatePhysics"/> at
  57. /// runtime since it won't work correctly.
  58. /// </remarks>
  59. AnimatorUpdateMode? InitialUpdateMode { get; }
  60. /************************************************************************************************************************/
  61. #endif
  62. /************************************************************************************************************************/
  63. }
  64. }