SABoneCollider.cs 3.5 KB

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