CharacterCache.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace UnityEditor.U2D.Animation
  6. {
  7. internal class CharacterCache : SkinningObject, IEnumerable<CharacterPartCache>
  8. {
  9. [SerializeField]
  10. private SkeletonCache m_Skeleton;
  11. [SerializeField]
  12. private List<CharacterPartCache> m_Parts = new List<CharacterPartCache>();
  13. [SerializeField]
  14. private Vector2Int m_Dimension;
  15. [SerializeField]
  16. private List<CharacterGroupCache> m_Groups = new List<CharacterGroupCache>();
  17. public SkeletonCache skeleton
  18. {
  19. get { return m_Skeleton; }
  20. set { m_Skeleton = value; }
  21. }
  22. public virtual CharacterPartCache[] parts
  23. {
  24. get { return m_Parts.ToArray(); }
  25. set { m_Parts = new List<CharacterPartCache>(value); }
  26. }
  27. public virtual CharacterGroupCache[] groups
  28. {
  29. get { return m_Groups.ToArray(); }
  30. set { m_Groups = new List<CharacterGroupCache>(value); }
  31. }
  32. public Vector2Int dimension
  33. {
  34. get { return m_Dimension; }
  35. set { m_Dimension = value; }
  36. }
  37. public IEnumerator<CharacterPartCache> GetEnumerator()
  38. {
  39. return ((IEnumerable<CharacterPartCache>)m_Parts).GetEnumerator();
  40. }
  41. IEnumerator IEnumerable.GetEnumerator()
  42. {
  43. return ((IEnumerable<CharacterPartCache>)m_Parts).GetEnumerator();
  44. }
  45. }
  46. }