using UnityEngine; namespace ECE { /// /// Data holder for collider calculations. /// public class EasyColliderData { /// /// Type of collider data /// public CREATE_COLLIDER_TYPE ColliderType; /// /// Did the collider calculation complete /// public bool IsValid = false; /// /// TRS matrix of the attach to object, or TRS matrix of what the rotated collider will have /// public Matrix4x4 Matrix; public void Clone(EasyColliderData data) { this.ColliderType = data.ColliderType; this.IsValid = data.IsValid; this.Matrix = data.Matrix; } } /// /// Data for creating a sphere collider /// public class SphereColliderData : EasyColliderData { /// /// Radius of the collider /// public float Radius; /// /// Center of the collider /// public Vector3 Center; public void Clone(SphereColliderData data) { base.Clone(data); this.Radius = data.Radius; this.Center = data.Center; } } /// /// Data for creating a capsule collider /// public class CapsuleColliderData : SphereColliderData { /// /// Direction of the capsule collider /// public int Direction; /// /// Height of the capsule collider /// public float Height; public void Clone(CapsuleColliderData data) { base.Clone(data); this.Direction = data.Direction; this.Height = data.Height; } } /// /// Data for creating a box collider /// public class BoxColliderData : EasyColliderData { /// /// Center of the box collider /// public Vector3 Center; /// /// Size of the box collider /// public Vector3 Size; public void Clone(BoxColliderData data) { base.Clone(data); this.Center = data.Center; this.Size = data.Size; this.Matrix = data.Matrix; } public override string ToString() { return "Rotated box collider. Center:" + Center.ToString() + " Size:" + Size.ToString(); } } /// /// Data for creating a mesh collider /// public class MeshColliderData : EasyColliderData { /// /// Mesh of the convex mesh collider /// public Mesh ConvexMesh; public void Clone(MeshColliderData data) { base.Clone(data); this.ConvexMesh = data.ConvexMesh; } } }