IAnimancerComponent.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
  2. using UnityEngine;
  3. namespace Animancer
  4. {
  5. /// <summary>Interface for components that manage an <see cref="AnimancerGraph"/>.</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. /// <strong>Documentation:</strong>
  14. /// <see href="https://kybernetik.com.au/animancer/docs/manual/playing/component-types">
  15. /// Component Types</see>
  16. /// </remarks>
  17. /// https://kybernetik.com.au/animancer/api/Animancer/IAnimancerComponent
  18. ///
  19. public interface IAnimancerComponent
  20. {
  21. /************************************************************************************************************************/
  22. #pragma warning disable IDE1006 // Naming Styles.
  23. /************************************************************************************************************************/
  24. /// <summary>Will this component be updated?</summary>
  25. bool enabled { get; }
  26. /// <summary>The <see cref="GameObject"/> this component is attached to.</summary>
  27. GameObject gameObject { get; }
  28. /************************************************************************************************************************/
  29. #pragma warning restore IDE1006 // Naming Styles.
  30. /************************************************************************************************************************/
  31. /// <summary>The <see cref="UnityEngine.Animator"/> component which this script controls.</summary>
  32. Animator Animator { get; set; }
  33. /// <summary>The internal system which manages the playing animations.</summary>
  34. AnimancerGraph Graph { get; }
  35. /// <summary>Has the <see cref="Graph"/> been initialized?</summary>
  36. bool IsGraphInitialized { get; }
  37. /// <summary>Will the object be reset to its original values when disabled?</summary>
  38. bool ResetOnDisable { get; }
  39. /// <summary>
  40. /// Determines when animations are updated and which time source is used. This property is mainly a wrapper
  41. /// around the <see cref="Animator.updateMode"/>.
  42. /// </summary>
  43. AnimatorUpdateMode UpdateMode { get; set; }
  44. /************************************************************************************************************************/
  45. /// <summary>Returns the dictionary key to use for the `clip`.</summary>
  46. object GetKey(AnimationClip clip);
  47. /************************************************************************************************************************/
  48. #if UNITY_EDITOR
  49. /************************************************************************************************************************/
  50. /// <summary>[Editor-Only] The name of the serialized backing field for the <see cref="Animator"/> property.</summary>
  51. string AnimatorFieldName { get; }
  52. /// <summary>[Editor-Only]
  53. /// The name of the serialized backing field for the <see cref="AnimancerComponent.ActionOnDisable"/> property.
  54. /// </summary>
  55. string ActionOnDisableFieldName { get; }
  56. /// <summary>[Editor-Only] The <see cref="UpdateMode"/> that was first used when this script initialized.</summary>
  57. /// <remarks>
  58. /// This is used to give a warning when changing to or from <see cref="AnimatorUpdateMode.AnimatePhysics"/> at
  59. /// runtime since it won't work correctly.
  60. /// </remarks>
  61. AnimatorUpdateMode? InitialUpdateMode { get; }
  62. /************************************************************************************************************************/
  63. #endif
  64. /************************************************************************************************************************/
  65. }
  66. }