SAMeshCollider.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System;
  2. using UnityEngine;
  3. public class SAMeshCollider : MonoBehaviour
  4. {
  5. public SAMeshColliderCommon.SplitProperty splitProperty
  6. {
  7. get
  8. {
  9. return (this.meshColliderProperty == null) ? null : this.meshColliderProperty.splitProperty;
  10. }
  11. }
  12. public SAColliderBuilderCommon.ReducerProperty reducerProperty
  13. {
  14. get
  15. {
  16. return (this.meshColliderProperty == null) ? null : this.meshColliderProperty.reducerProperty;
  17. }
  18. }
  19. public SAColliderBuilderCommon.ColliderProperty colliderProperty
  20. {
  21. get
  22. {
  23. return (this.meshColliderProperty == null) ? null : this.meshColliderProperty.colliderProperty;
  24. }
  25. }
  26. public SAColliderBuilderCommon.RigidbodyProperty rigidbodyProperty
  27. {
  28. get
  29. {
  30. return (this.meshColliderProperty == null) ? null : this.meshColliderProperty.rigidbodyProperty;
  31. }
  32. }
  33. public bool splitMaterialEnabled
  34. {
  35. get
  36. {
  37. return this.splitProperty != null && this.splitProperty.splitMaterialEnabled;
  38. }
  39. }
  40. public bool splitPrimitiveEnabled
  41. {
  42. get
  43. {
  44. return this.splitProperty != null && this.splitProperty.splitPrimitiveEnabled;
  45. }
  46. }
  47. public bool splitPolygonNormalEnabled
  48. {
  49. get
  50. {
  51. return this.splitProperty != null && this.splitProperty.splitPolygonNormalEnabled;
  52. }
  53. }
  54. public float splitPolygonNormalAngle
  55. {
  56. get
  57. {
  58. return (this.splitProperty == null) ? 0f : this.splitProperty.splitPolygonNormalAngle;
  59. }
  60. }
  61. public bool modifyNameEnalbed
  62. {
  63. get
  64. {
  65. return this.meshColliderProperty != null && this.meshColliderProperty.modifyNameEnabled;
  66. }
  67. }
  68. public void ChangeDefaultName(string defaultName)
  69. {
  70. bool flag = this._IsModifyName();
  71. this.defaultName = defaultName;
  72. if (this.modifyNameEnalbed && flag)
  73. {
  74. base.gameObject.name = this._ComputeModifyName();
  75. }
  76. }
  77. public void ChangeModified(bool modified)
  78. {
  79. bool flag = this._IsModifyName();
  80. this.modified = modified;
  81. if (this.modifyNameEnalbed && flag)
  82. {
  83. base.gameObject.name = this._ComputeModifyName();
  84. }
  85. }
  86. public void ChangeModifiedChildren(bool modifiedChildren)
  87. {
  88. bool flag = this._IsModifyName();
  89. this.modifiedChildren = modifiedChildren;
  90. if (this.modifyNameEnalbed && flag)
  91. {
  92. base.gameObject.name = this._ComputeModifyName();
  93. }
  94. }
  95. public void ResetModified()
  96. {
  97. bool flag = this._IsModifyName();
  98. this.modified = false;
  99. this.modifiedChildren = false;
  100. if (this.modifyNameEnalbed && flag)
  101. {
  102. base.gameObject.name = this._ComputeModifyName();
  103. }
  104. }
  105. public void ResetModifyName()
  106. {
  107. if (this.modifyNameEnalbed)
  108. {
  109. base.gameObject.name = this._ComputeModifyName();
  110. }
  111. }
  112. public string _ComputeModifyName()
  113. {
  114. if (this.modifyNameEnalbed)
  115. {
  116. if (this.modified)
  117. {
  118. if (string.IsNullOrEmpty(this.defaultName))
  119. {
  120. return "*";
  121. }
  122. return this.defaultName + "*";
  123. }
  124. else if (this.modifiedChildren)
  125. {
  126. if (string.IsNullOrEmpty(this.defaultName))
  127. {
  128. return "+";
  129. }
  130. return this.defaultName + "+";
  131. }
  132. }
  133. if (string.IsNullOrEmpty(this.defaultName))
  134. {
  135. return string.Empty;
  136. }
  137. return this.defaultName;
  138. }
  139. public bool _IsModifyName()
  140. {
  141. if (!this.modifyNameEnalbed)
  142. {
  143. return false;
  144. }
  145. if (string.IsNullOrEmpty(base.gameObject.name))
  146. {
  147. return string.IsNullOrEmpty(this._ComputeModifyName());
  148. }
  149. return base.gameObject.name == this._ComputeModifyName();
  150. }
  151. public SAMeshColliderCommon.SplitMesh splitMesh = new SAMeshColliderCommon.SplitMesh();
  152. public SAMeshColliderCommon.SplitMode splitMode;
  153. public SAMeshColliderCommon.SAMeshColliderProperty meshColliderProperty = new SAMeshColliderCommon.SAMeshColliderProperty();
  154. public string defaultName = string.Empty;
  155. public SAMeshColliderCommon.SAMeshColliderProperty defaultMeshColliderProperty = new SAMeshColliderCommon.SAMeshColliderProperty();
  156. [NonSerialized]
  157. public SAMeshColliderCommon.SAMeshColliderProperty edittingMeshCollidertProperty;
  158. public bool modified;
  159. public bool modifiedChildren;
  160. [NonSerialized]
  161. public bool cleanupModified;
  162. [NonSerialized]
  163. public bool isDebug;
  164. }