SAColliderBuilderCommon.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using System;
  2. using UnityEngine;
  3. public class SAColliderBuilderCommon
  4. {
  5. public enum ShapeType
  6. {
  7. None,
  8. Mesh,
  9. Box,
  10. Capsule,
  11. Sphere
  12. }
  13. public enum FitType
  14. {
  15. Outer,
  16. Inner
  17. }
  18. public enum MeshType
  19. {
  20. Raw,
  21. ConvexBoxes,
  22. ConvexHull,
  23. Box
  24. }
  25. public enum SliceMode
  26. {
  27. Auto,
  28. X,
  29. Y,
  30. Z
  31. }
  32. public enum ElementType
  33. {
  34. X,
  35. XYZ
  36. }
  37. [Serializable]
  38. public struct Bool3
  39. {
  40. public Bool3(bool x, bool y, bool z)
  41. {
  42. this.x = x;
  43. this.y = y;
  44. this.z = z;
  45. }
  46. public void SetValue(bool x, bool y, bool z)
  47. {
  48. this.x = x;
  49. this.y = y;
  50. this.z = z;
  51. }
  52. public bool x;
  53. public bool y;
  54. public bool z;
  55. }
  56. public enum ColliderToChild
  57. {
  58. Auto,
  59. On,
  60. Off
  61. }
  62. [Serializable]
  63. public class ReducerProperty
  64. {
  65. public SAColliderBuilderCommon.ReducerProperty ShallowCopy()
  66. {
  67. return (SAColliderBuilderCommon.ReducerProperty)base.MemberwiseClone();
  68. }
  69. public SAColliderBuilderCommon.ShapeType shapeType = SAColliderBuilderCommon.ShapeType.Box;
  70. public SAColliderBuilderCommon.FitType fitType;
  71. public SAColliderBuilderCommon.MeshType meshType = SAColliderBuilderCommon.MeshType.Box;
  72. public int maxTriangles = 255;
  73. public SAColliderBuilderCommon.SliceMode sliceMode;
  74. public Vector3 scale = Vector3.one;
  75. public SAColliderBuilderCommon.ElementType scaleElementType;
  76. public Vector3 minThickness = new Vector3(0.01f, 0.01f, 0.01f);
  77. public SAColliderBuilderCommon.ElementType minThicknessElementType;
  78. public SAColliderBuilderCommon.Bool3 optimizeRotation = new SAColliderBuilderCommon.Bool3(true, true, true);
  79. public SAColliderBuilderCommon.ElementType optimizeRotationElementType;
  80. public SAColliderBuilderCommon.ColliderToChild colliderToChild;
  81. public Vector3 offset = Vector3.zero;
  82. public Vector3 thicknessA = Vector3.zero;
  83. public Vector3 thicknessB = Vector3.zero;
  84. public bool viewAdvanced;
  85. }
  86. [Serializable]
  87. public class ColliderProperty
  88. {
  89. public SAColliderBuilderCommon.ColliderProperty ShallowCopy()
  90. {
  91. return (SAColliderBuilderCommon.ColliderProperty)base.MemberwiseClone();
  92. }
  93. public bool convex = true;
  94. public bool isTrigger;
  95. public PhysicMaterial material;
  96. public bool isCreateAsset;
  97. }
  98. [Serializable]
  99. public class RigidbodyProperty
  100. {
  101. public SAColliderBuilderCommon.RigidbodyProperty ShallowCopy()
  102. {
  103. return (SAColliderBuilderCommon.RigidbodyProperty)base.MemberwiseClone();
  104. }
  105. public float mass = 1f;
  106. public float drag;
  107. public float angularDrag = 0.05f;
  108. public bool isKinematic = true;
  109. public bool useGravity;
  110. public RigidbodyInterpolation interpolation;
  111. public CollisionDetectionMode collisionDetectionMode;
  112. public bool isCreate = true;
  113. public bool viewAdvanced;
  114. }
  115. }