BoxPoints.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace O3DWB
  6. {
  7. public static class BoxPoints
  8. {
  9. #region Private Static Variables
  10. private static readonly BoxPoint[] _points;
  11. private static readonly int _count;
  12. #endregion
  13. #region Constructors
  14. static BoxPoints()
  15. {
  16. _count = Enum.GetValues(typeof(BoxPoint)).Length;
  17. _points = new BoxPoint[_count];
  18. _points[(int)BoxPoint.Center] = BoxPoint.Center;
  19. _points[(int)BoxPoint.FrontBottomLeft] = BoxPoint.FrontBottomLeft;
  20. _points[(int)BoxPoint.FrontBottomRight] = BoxPoint.FrontBottomRight;
  21. _points[(int)BoxPoint.FrontTopLeft] = BoxPoint.FrontTopLeft;
  22. _points[(int)BoxPoint.FrontTopRight] = BoxPoint.FrontTopRight;
  23. _points[(int)BoxPoint.BackBottomLeft] = BoxPoint.BackBottomLeft;
  24. _points[(int)BoxPoint.BackBottomRight] = BoxPoint.BackBottomRight;
  25. _points[(int)BoxPoint.BackTopLeft] = BoxPoint.BackTopLeft;
  26. _points[(int)BoxPoint.BackTopRight] = BoxPoint.BackTopRight;
  27. }
  28. #endregion
  29. #region Public Static Properties
  30. public static int Count { get { return _count; } }
  31. #endregion
  32. #region Public Static Functions
  33. public static List<BoxPoint> GetAll()
  34. {
  35. return new List<BoxPoint>(_points);
  36. }
  37. #endregion
  38. }
  39. }
  40. #endif