SpriteCache.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace UnityEditor.U2D.Animation
  5. {
  6. internal class SpriteCache : TransformCache
  7. {
  8. [SerializeField]
  9. private string m_ID;
  10. [SerializeField]
  11. private Rect m_TextureRect;
  12. [SerializeField]
  13. private Vector2 m_PivotNormalized;
  14. public string id
  15. {
  16. get { return m_ID; }
  17. internal set { m_ID = value; }
  18. }
  19. public Rect textureRect
  20. {
  21. get { return m_TextureRect; }
  22. set { m_TextureRect = value; }
  23. }
  24. public Vector2 pivotNormalized
  25. {
  26. get { return m_PivotNormalized; }
  27. set { m_PivotNormalized = value; }
  28. }
  29. public Vector2 pivotRectSpace
  30. {
  31. get { return Vector2.Scale(textureRect.size, pivotNormalized); }
  32. }
  33. public Vector2 pivotTextureSpace
  34. {
  35. get { return localToWorldMatrix.MultiplyPoint3x4(pivotRectSpace); }
  36. }
  37. }
  38. }