using System; using UnityEngine; public class SAMeshColliderCommon { public enum SplitMode { None, Material, Primitive, Polygon } [Serializable] public class SplitMesh { public void PurgeTemporary() { this.triangles = null; this.vertices = null; this.triangleNormals = null; } public int subMeshCount; public int subMesh = -1; public int triangle = -1; public Vector3 triangleVertex; public int[] polygonTriangles; public Vector3[] polygonVertices; [NonSerialized] public int[] triangles; [NonSerialized] public Vector3[] vertices; [NonSerialized] public Vector3[] triangleNormals; } [Serializable] public class SplitProperty { public SAMeshColliderCommon.SplitProperty ShallowCopy() { return (SAMeshColliderCommon.SplitProperty)base.MemberwiseClone(); } public bool splitMaterialEnabled = true; public bool splitPrimitiveEnabled = true; public bool splitPolygonNormalEnabled; public float splitPolygonNormalAngle = 45f; } [Serializable] public class SAMeshColliderProperty { public SAMeshColliderCommon.SAMeshColliderProperty Copy() { SAMeshColliderCommon.SAMeshColliderProperty sameshColliderProperty = new SAMeshColliderCommon.SAMeshColliderProperty(); if (this.splitProperty != null) { sameshColliderProperty.splitProperty = this.splitProperty.ShallowCopy(); } if (this.reducerProperty != null) { sameshColliderProperty.reducerProperty = this.reducerProperty.ShallowCopy(); } if (this.colliderProperty != null) { sameshColliderProperty.colliderProperty = this.colliderProperty.ShallowCopy(); } if (this.rigidbodyProperty != null) { sameshColliderProperty.rigidbodyProperty = this.rigidbodyProperty.ShallowCopy(); } sameshColliderProperty.modifyNameEnabled = this.modifyNameEnabled; return sameshColliderProperty; } public SAMeshColliderCommon.SplitProperty splitProperty = new SAMeshColliderCommon.SplitProperty(); public SAColliderBuilderCommon.ReducerProperty reducerProperty = new SAColliderBuilderCommon.ReducerProperty(); public SAColliderBuilderCommon.ColliderProperty colliderProperty = new SAColliderBuilderCommon.ColliderProperty(); public SAColliderBuilderCommon.RigidbodyProperty rigidbodyProperty = new SAColliderBuilderCommon.RigidbodyProperty(); public bool modifyNameEnabled = true; } [Serializable] public class SAMeshColliderBuilderProperty { public SAMeshColliderCommon.SAMeshColliderBuilderProperty Copy() { SAMeshColliderCommon.SAMeshColliderBuilderProperty sameshColliderBuilderProperty = new SAMeshColliderCommon.SAMeshColliderBuilderProperty(); if (this.splitProperty != null) { sameshColliderBuilderProperty.splitProperty = this.splitProperty.ShallowCopy(); } if (this.reducerProperty != null) { sameshColliderBuilderProperty.reducerProperty = this.reducerProperty.ShallowCopy(); } if (this.colliderProperty != null) { sameshColliderBuilderProperty.colliderProperty = this.colliderProperty.ShallowCopy(); } if (this.rigidbodyProperty != null) { sameshColliderBuilderProperty.rigidbodyProperty = this.rigidbodyProperty.ShallowCopy(); } sameshColliderBuilderProperty.modifyNameEnabled = this.modifyNameEnabled; return sameshColliderBuilderProperty; } public SAMeshColliderCommon.SAMeshColliderProperty ToSAMeshColliderProperty() { SAMeshColliderCommon.SAMeshColliderProperty sameshColliderProperty = new SAMeshColliderCommon.SAMeshColliderProperty(); if (this.splitProperty != null) { sameshColliderProperty.splitProperty = this.splitProperty.ShallowCopy(); } if (this.reducerProperty != null) { sameshColliderProperty.reducerProperty = this.reducerProperty.ShallowCopy(); } if (this.colliderProperty != null) { sameshColliderProperty.colliderProperty = this.colliderProperty.ShallowCopy(); } if (this.rigidbodyProperty != null) { sameshColliderProperty.rigidbodyProperty = this.rigidbodyProperty.ShallowCopy(); } sameshColliderProperty.modifyNameEnabled = this.modifyNameEnabled; return sameshColliderProperty; } public SAMeshColliderCommon.SplitProperty splitProperty = new SAMeshColliderCommon.SplitProperty(); public SAColliderBuilderCommon.ReducerProperty reducerProperty = new SAColliderBuilderCommon.ReducerProperty(); public SAColliderBuilderCommon.ColliderProperty colliderProperty = new SAColliderBuilderCommon.ColliderProperty(); public SAColliderBuilderCommon.RigidbodyProperty rigidbodyProperty = new SAColliderBuilderCommon.RigidbodyProperty(); public bool modifyNameEnabled = true; } }