Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Lethal Croc v1.0.0
LethalCroc.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EZhex1991.EZSoftBone; using HarmonyLib; using Microsoft.CodeAnalysis; using ModelReplacement; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("LethalCroc")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalCroc")] [assembly: AssemblyTitle("LethalCroc")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace EZhex1991.EZSoftBone { public class EZCurveRectAttribute : PropertyAttribute { public Rect rect; public Color color = Color.green; public EZCurveRectAttribute() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) rect = new Rect(0f, 0f, 1f, 1f); } public EZCurveRectAttribute(Rect rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) this.rect = rect; } public EZCurveRectAttribute(float x, float y, float width, float height) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) rect = new Rect(x, y, width, height); } public EZCurveRectAttribute(Rect rect, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) this.rect = rect; this.color = color; } public EZCurveRectAttribute(float x, float y, float width, float height, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) rect = new Rect(x, y, width, height); this.color = color; } } public class EZNestedEditorAttribute : PropertyAttribute { } public delegate Vector3 CustomForce(float normalizedLength); public class EZSoftBone : MonoBehaviour { public enum UnificationMode { None, Rooted, Unified } public enum DeltaTimeMode { DeltaTime, UnscaledDeltaTime, Constant } private class Bone { public Bone parentBone; public Vector3 localPosition; public Quaternion localRotation; public Bone leftBone; public Vector3 leftPosition; public Bone rightBone; public Vector3 rightPosition; public List<Bone> childBones = new List<Bone>(); public Transform transform; public Vector3 worldPosition; public Transform systemSpace; public Vector3 systemPosition; public int depth; public float boneLength; public float treeLength; public float normalizedLength; public float radius; public float damping; public float stiffness; public float resistance; public float slackness; public Vector3 speed; public Bone(Transform systemSpace, Transform transform, IEnumerable<Transform> endBones, int startDepth, int depth, float nodeLength, float boneLength) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) this.transform = transform; this.systemSpace = systemSpace; worldPosition = transform.position; systemPosition = (((Object)(object)systemSpace == (Object)null) ? worldPosition : systemSpace.InverseTransformPoint(worldPosition)); localPosition = transform.localPosition; localRotation = transform.localRotation; this.depth = depth; if (depth > startDepth) { this.boneLength = boneLength + nodeLength; } treeLength = Mathf.Max(treeLength, this.boneLength); if (transform.childCount > 0 && !endBones.Contains(transform)) { for (int i = 0; i < transform.childCount; i++) { Transform child = transform.GetChild(i); if (((Component)child).gameObject.activeSelf) { Bone bone = new Bone(systemSpace, child, endBones, startDepth, depth + 1, Vector3.Distance(child.position, transform.position), this.boneLength) { parentBone = this }; childBones.Add(bone); treeLength = Mathf.Max(treeLength, bone.treeLength); } } } normalizedLength = ((treeLength == 0f) ? 0f : (this.boneLength / treeLength)); } public void SetTreeLength() { SetTreeLength(treeLength); } public void SetTreeLength(float treeLength) { this.treeLength = treeLength; normalizedLength = ((treeLength == 0f) ? 0f : (boneLength / treeLength)); for (int i = 0; i < childBones.Count; i++) { childBones[i].SetTreeLength(treeLength); } } public void SetLeftSibling(Bone left) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (left != this && left != rightBone) { leftBone = left; leftPosition = transform.InverseTransformPoint(left.worldPosition); } } public void SetRightSibling(Bone right) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (right != this && right != leftBone) { rightBone = right; rightPosition = transform.InverseTransformPoint(right.worldPosition); } } public void Inflate(float baseRadius, AnimationCurve radiusCurve) { radius = radiusCurve.Evaluate(normalizedLength) * baseRadius; for (int i = 0; i < childBones.Count; i++) { childBones[i].Inflate(baseRadius, radiusCurve); } } public void Inflate(float baseRadius, AnimationCurve radiusCurve, EZSoftBoneMaterial material) { radius = radiusCurve.Evaluate(normalizedLength) * baseRadius; damping = material.GetDamping(normalizedLength); stiffness = material.GetStiffness(normalizedLength); resistance = material.GetResistance(normalizedLength); slackness = material.GetSlackness(normalizedLength); for (int i = 0; i < childBones.Count; i++) { childBones[i].Inflate(baseRadius, radiusCurve, material); } } public void RevertTransforms(int startDepth) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (depth > startDepth) { transform.localPosition = localPosition; transform.localRotation = localRotation; } for (int i = 0; i < childBones.Count; i++) { childBones[i].RevertTransforms(startDepth); } } public void UpdateTransform(bool siblingRotationConstraints, int startDepth) { //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) if (depth > startDepth) { if (childBones.Count == 1) { Bone bone = childBones[0]; Transform obj = transform; obj.rotation *= Quaternion.FromToRotation(bone.localPosition, transform.InverseTransformVector(bone.worldPosition - worldPosition)); if (siblingRotationConstraints) { if (leftBone != null && rightBone != null) { Vector3 val = leftPosition; Vector3 val2 = transform.InverseTransformVector(leftBone.worldPosition - worldPosition); Quaternion val3 = Quaternion.FromToRotation(val, val2); Vector3 val4 = rightPosition; Vector3 val5 = transform.InverseTransformVector(rightBone.worldPosition - worldPosition); Quaternion val6 = Quaternion.FromToRotation(val4, val5); Transform obj2 = transform; obj2.rotation *= Quaternion.Lerp(val3, val6, 0.5f); } else if (leftBone != null) { Vector3 val7 = leftPosition; Vector3 val8 = transform.InverseTransformVector(leftBone.worldPosition - worldPosition); Quaternion val9 = Quaternion.FromToRotation(val7, val8); Transform obj3 = transform; obj3.rotation *= val9; } else if (rightBone != null) { Vector3 val10 = rightPosition; Vector3 val11 = transform.InverseTransformVector(rightBone.worldPosition - worldPosition); Quaternion val12 = Quaternion.FromToRotation(val10, val11); Transform obj4 = transform; obj4.rotation *= val12; } } } transform.position = worldPosition; } if ((Object)(object)systemSpace != (Object)null) { systemPosition = systemSpace.InverseTransformPoint(worldPosition); } for (int i = 0; i < childBones.Count; i++) { childBones[i].UpdateTransform(siblingRotationConstraints, startDepth); } } public void SetRestState() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) worldPosition = transform.position; systemPosition = (((Object)(object)systemSpace == (Object)null) ? worldPosition : systemSpace.InverseTransformPoint(worldPosition)); speed = Vector3.zero; for (int i = 0; i < childBones.Count; i++) { childBones[i].SetRestState(); } } public void UpdateSpace() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)systemSpace == (Object)null)) { worldPosition = systemSpace.TransformPoint(systemPosition); for (int i = 0; i < childBones.Count; i++) { childBones[i].UpdateSpace(); } } } } public static readonly float DeltaTime_Min = 1E-06f; [SerializeField] private List<Transform> m_RootBones; [SerializeField] private List<Transform> m_EndBones; [SerializeField] private EZSoftBoneMaterial m_Material; private EZSoftBoneMaterial m_InstanceMaterial; [SerializeField] private int m_StartDepth; [SerializeField] private UnificationMode m_SiblingConstraints; [SerializeField] private bool m_ClosedSiblings; [SerializeField] private bool m_SiblingRotationConstraints = true; [SerializeField] private UnificationMode m_LengthUnification; [SerializeField] private LayerMask m_CollisionLayers = LayerMask.op_Implicit(1); [SerializeField] private List<Collider> m_ExtraColliders = new List<Collider>(); [SerializeField] private float m_Radius; [SerializeField] [EZCurveRect(0f, 0f, 1f, 1f)] private AnimationCurve m_RadiusCurve = AnimationCurve.Linear(0f, 1f, 1f, 1f); [SerializeField] private DeltaTimeMode m_DeltaTimeMode; [SerializeField] private float m_ConstantDeltaTime = 0.03f; [SerializeField] [Range(1f, 10f)] private int m_Iterations = 1; [SerializeField] private float m_SleepThreshold = 0.005f; [SerializeField] private Transform m_GravityAligner; [SerializeField] private Vector3 m_Gravity; [SerializeField] private EZSoftBoneForceField m_ForceModule; [SerializeField] private float m_ForceScale = 1f; [SerializeField] private Transform m_SimulateSpace; public CustomForce customForce; private List<Bone> m_Structures = new List<Bone>(); public List<Transform> rootBones { get { return m_RootBones; } set { m_RootBones = value; } } public List<Transform> endBones => m_EndBones; public EZSoftBoneMaterial sharedMaterial { get { if ((Object)(object)m_Material == (Object)null) { m_Material = EZSoftBoneMaterial.defaultMaterial; } return m_Material; } set { m_Material = value; } } public EZSoftBoneMaterial material { get { if ((Object)(object)m_InstanceMaterial == (Object)null) { m_InstanceMaterial = (m_Material = Object.Instantiate<EZSoftBoneMaterial>(sharedMaterial)); } return m_InstanceMaterial; } set { m_InstanceMaterial = (m_Material = value); } } public int startDepth { get { return m_StartDepth; } set { m_StartDepth = value; } } public UnificationMode siblingConstraints { get { return m_SiblingConstraints; } set { m_SiblingConstraints = value; } } public bool closedSiblings { get { return m_ClosedSiblings; } set { m_ClosedSiblings = value; } } public bool siblingRotationConstraints { get { return m_SiblingRotationConstraints; } set { m_SiblingRotationConstraints = value; } } public UnificationMode lengthUnification { get { return m_LengthUnification; } set { m_LengthUnification = value; } } public LayerMask collisionLayers { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_CollisionLayers; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) m_CollisionLayers = value; } } public List<Collider> extraColliders => m_ExtraColliders; public float radius { get { return m_Radius; } set { m_Radius = value; } } public AnimationCurve radiusCurve => m_RadiusCurve; public DeltaTimeMode deltaTimeMode { get { return m_DeltaTimeMode; } set { m_DeltaTimeMode = value; } } public float constantDeltaTime { get { return m_ConstantDeltaTime; } set { m_ConstantDeltaTime = value; } } public int iterations { get { return m_Iterations; } set { m_Iterations = value; } } public float sleepThreshold { get { return m_SleepThreshold; } set { m_SleepThreshold = Mathf.Max(0f, value); } } public Transform gravityAligner { get { return m_GravityAligner; } set { m_GravityAligner = value; } } public Vector3 gravity { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_Gravity; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) m_Gravity = value; } } public EZSoftBoneForceField forceModule { get { return m_ForceModule; } set { m_ForceModule = value; } } public float forceScale { get { return m_ForceScale; } set { m_ForceScale = value; } } public Transform simulateSpace { get { return m_SimulateSpace; } set { m_SimulateSpace = value; } } public float globalRadius { get; private set; } public Vector3 globalForce { get; private set; } private void Awake() { InitStructures(); } private void OnEnable() { SetRestState(); } private void Update() { RevertTransforms(startDepth); } private void LateUpdate() { switch (deltaTimeMode) { case DeltaTimeMode.DeltaTime: UpdateStructures(Time.deltaTime); break; case DeltaTimeMode.UnscaledDeltaTime: UpdateStructures(Time.unscaledDeltaTime); break; case DeltaTimeMode.Constant: UpdateStructures(constantDeltaTime); break; } UpdateTransforms(); } private void OnDisable() { RevertTransforms(startDepth); } public void RevertTransforms() { RevertTransforms(startDepth); } public void RevertTransforms(int startDepth) { for (int i = 0; i < m_Structures.Count; i++) { m_Structures[i].RevertTransforms(startDepth); } } public void InitStructures() { CreateBones(); SetSiblings(); SetTreeLength(); RefreshRadius(); } public void SetRestState() { for (int i = 0; i < m_Structures.Count; i++) { m_Structures[i].SetRestState(); } } private void CreateBones() { m_Structures.Clear(); if (rootBones == null || rootBones.Count == 0) { return; } for (int i = 0; i < rootBones.Count; i++) { if (!((Object)(object)rootBones[i] == (Object)null)) { Bone item = new Bone(simulateSpace, rootBones[i], endBones, startDepth, 0, 0f, 0f); m_Structures.Add(item); } } } private void SetSiblings() { if (siblingConstraints == UnificationMode.Rooted) { for (int i = 0; i < m_Structures.Count; i++) { Queue<Bone> queue = new Queue<Bone>(); queue.Enqueue(m_Structures[i]); SetSiblingsByDepth(queue, closedSiblings); } } else if (siblingConstraints == UnificationMode.Unified) { Queue<Bone> queue2 = new Queue<Bone>(); for (int j = 0; j < m_Structures.Count; j++) { queue2.Enqueue(m_Structures[j]); } if (queue2.Count > 0) { SetSiblingsByDepth(queue2, closedSiblings); } } } private void SetSiblingsByDepth(Queue<Bone> bones, bool closed) { Bone bone = bones.Dequeue(); for (int i = 0; i < bone.childBones.Count; i++) { bones.Enqueue(bone.childBones[i]); } Bone bone2 = bone; Bone bone3 = null; while (bones.Count > 0) { bone3 = bones.Dequeue(); for (int j = 0; j < bone3.childBones.Count; j++) { bones.Enqueue(bone3.childBones[j]); } if (bone2.depth == bone3.depth) { bone2.SetRightSibling(bone3); bone3.SetLeftSibling(bone2); } else { if (closed) { bone2.SetRightSibling(bone); bone.SetLeftSibling(bone2); } bone = bone3; } bone2 = bone3; } if (bone3 != null && closed) { bone.SetLeftSibling(bone3); bone3.SetRightSibling(bone); } } private void SetTreeLength() { if (lengthUnification == UnificationMode.Rooted) { for (int i = 0; i < m_Structures.Count; i++) { m_Structures[i].SetTreeLength(); } } else if (lengthUnification == UnificationMode.Unified) { float num = 0f; for (int j = 0; j < m_Structures.Count; j++) { num = Mathf.Max(num, m_Structures[j].treeLength); } for (int k = 0; k < m_Structures.Count; k++) { m_Structures[k].SetTreeLength(num); } } } public void RefreshRadius() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) globalRadius = ((Component)this).transform.lossyScale.Abs().Max() * radius; for (int i = 0; i < m_Structures.Count; i++) { m_Structures[i].Inflate(globalRadius, radiusCurve); } } private void UpdateStructures(float deltaTime) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (deltaTime <= DeltaTime_Min) { return; } globalRadius = ((Component)this).transform.lossyScale.Abs().Max() * radius; for (int i = 0; i < m_Structures.Count; i++) { m_Structures[i].Inflate(globalRadius, radiusCurve, sharedMaterial); if ((Object)(object)simulateSpace != (Object)null) { m_Structures[i].UpdateSpace(); } } globalForce = gravity; if ((Object)(object)gravityAligner != (Object)null) { Vector3 val = gravityAligner.TransformDirection(gravity); Vector3 normalized = ((Vector3)(ref val)).normalized; val = gravity; Vector3 normalized2 = ((Vector3)(ref val)).normalized; float num = Mathf.Acos(Vector3.Dot(normalized, normalized2)) / MathF.PI; globalForce *= num; } deltaTime /= (float)iterations; for (int j = 0; j < iterations; j++) { for (int k = 0; k < m_Structures.Count; k++) { UpdateBones(m_Structures[k], deltaTime); } } } private void UpdateBones(Bone bone, float deltaTime) { //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) if (bone.depth > startDepth) { Vector3 val; Vector3 val2 = (val = bone.worldPosition); Vector3 val3 = globalForce; if ((Object)(object)forceModule != (Object)null && ((Behaviour)forceModule).isActiveAndEnabled) { val3 += forceModule.GetForce(bone.normalizedLength) * forceScale; } if (customForce != null) { val3 += customForce(bone.normalizedLength); } val3.x *= ((Component)this).transform.localScale.x; val3.y *= ((Component)this).transform.localScale.y; val3.z *= ((Component)this).transform.localScale.z; bone.speed += val3 * (1f - bone.resistance) / (float)iterations; bone.speed *= 1f - bone.damping; if (((Vector3)(ref bone.speed)).sqrMagnitude > sleepThreshold) { val += bone.speed * deltaTime; } Vector3 val4 = bone.parentBone.worldPosition - bone.parentBone.transform.position; Vector3 val5 = bone.parentBone.transform.TransformPoint(bone.localPosition) + val4; val = Vector3.Lerp(val, val5, bone.stiffness / (float)iterations); Vector3 val6 = val - bone.parentBone.worldPosition; Vector3 normalized = ((Vector3)(ref val6)).normalized; val6 = bone.parentBone.transform.TransformVector(bone.localPosition); float magnitude = ((Vector3)(ref val6)).magnitude; val5 = bone.parentBone.worldPosition + normalized * magnitude; int num = 1; if (siblingConstraints != 0) { if (bone.leftBone != null) { val6 = val - bone.leftBone.worldPosition; Vector3 normalized2 = ((Vector3)(ref val6)).normalized; val6 = bone.transform.TransformVector(bone.leftPosition); float magnitude2 = ((Vector3)(ref val6)).magnitude; val5 += bone.leftBone.worldPosition + normalized2 * magnitude2; num++; } if (bone.rightBone != null) { val6 = val - bone.rightBone.worldPosition; Vector3 normalized3 = ((Vector3)(ref val6)).normalized; val6 = bone.transform.TransformVector(bone.rightPosition); float magnitude3 = ((Vector3)(ref val6)).magnitude; val5 += bone.rightBone.worldPosition + normalized3 * magnitude3; num++; } } val5 /= (float)num; val = Vector3.Lerp(val5, val, bone.slackness / (float)iterations); if (bone.radius > 0f) { foreach (EZSoftBoneColliderBase enabledCollider in EZSoftBoneColliderBase.EnabledColliders) { if ((Object)(object)bone.transform != (Object)(object)((Component)enabledCollider).transform && collisionLayers.Contains(((Component)enabledCollider).gameObject.layer)) { enabledCollider.Collide(ref val, bone.radius); } } foreach (Collider extraCollider in extraColliders) { if ((Object)(object)bone.transform != (Object)(object)((Component)extraCollider).transform && extraCollider.enabled) { EZSoftBoneUtility.PointOutsideCollider(ref val, extraCollider, bone.radius); } } } bone.speed = (bone.speed + (val - val2) / deltaTime) * 0.5f; bone.worldPosition = val; } else { bone.worldPosition = bone.transform.position; } for (int i = 0; i < bone.childBones.Count; i++) { UpdateBones(bone.childBones[i], deltaTime); } } private void UpdateTransforms() { for (int i = 0; i < m_Structures.Count; i++) { m_Structures[i].UpdateTransform(siblingRotationConstraints, startDepth); } } } [RequireComponent(typeof(Collider))] public class EZSoftBoneCollider : EZSoftBoneColliderBase { [SerializeField] private Collider m_ReferenceCollider; [SerializeField] private float m_Margin; [SerializeField] private bool m_InsideMode; public Collider referenceCollider { get { if ((Object)(object)m_ReferenceCollider == (Object)null) { m_ReferenceCollider = ((Component)this).GetComponent<Collider>(); } return m_ReferenceCollider; } } public float margin { get { return m_Margin; } set { m_Margin = value; } } public bool insideMode { get { return m_InsideMode; } set { m_InsideMode = value; } } public override void Collide(ref Vector3 position, float spacing) { if (referenceCollider is SphereCollider) { Collider obj = referenceCollider; SphereCollider collider = (SphereCollider)(object)((obj is SphereCollider) ? obj : null); if (insideMode) { EZSoftBoneUtility.PointInsideSphere(ref position, collider, spacing + margin); } else { EZSoftBoneUtility.PointOutsideSphere(ref position, collider, spacing + margin); } } else if (referenceCollider is CapsuleCollider) { Collider obj2 = referenceCollider; CapsuleCollider collider2 = (CapsuleCollider)(object)((obj2 is CapsuleCollider) ? obj2 : null); if (insideMode) { EZSoftBoneUtility.PointInsideCapsule(ref position, collider2, spacing + margin); } else { EZSoftBoneUtility.PointOutsideCapsule(ref position, collider2, spacing + margin); } } else if (referenceCollider is BoxCollider) { Collider obj3 = referenceCollider; BoxCollider collider3 = (BoxCollider)(object)((obj3 is BoxCollider) ? obj3 : null); if (insideMode) { EZSoftBoneUtility.PointInsideBox(ref position, collider3, spacing + margin); } else { EZSoftBoneUtility.PointOutsideBox(ref position, collider3, spacing + margin); } } else if (referenceCollider is MeshCollider) { Collider obj4 = referenceCollider; if (!CheckConvex((MeshCollider)(object)((obj4 is MeshCollider) ? obj4 : null))) { Debug.LogError((object)"Non-Convex Mesh Collider is not supported", (Object)(object)this); ((Behaviour)this).enabled = false; } else if (insideMode) { Debug.LogError((object)"Inside Mode On Mesh Collider is not supported", (Object)(object)this); insideMode = false; } else { EZSoftBoneUtility.PointOutsideCollider(ref position, referenceCollider, spacing + margin); } } } private bool CheckConvex(MeshCollider meshCollider) { if ((Object)(object)meshCollider.sharedMesh != (Object)null) { return meshCollider.convex; } return false; } private void Reset() { m_ReferenceCollider = ((Component)this).GetComponent<Collider>(); } } public abstract class EZSoftBoneColliderBase : MonoBehaviour { public static HashSet<EZSoftBoneColliderBase> EnabledColliders = new HashSet<EZSoftBoneColliderBase>(); protected void OnEnable() { EnabledColliders.Add(this); } protected void OnDisable() { EnabledColliders.Remove(this); } public abstract void Collide(ref Vector3 position, float spacing); } public class EZSoftBoneColliderCylinder : EZSoftBoneColliderBase { [SerializeField] private float m_Margin; [SerializeField] private bool m_InsideMode; public float margin { get { return m_Margin; } set { m_Margin = value; } } public bool insideMode { get { return m_InsideMode; } set { m_InsideMode = value; } } public override void Collide(ref Vector3 position, float spacing) { if (insideMode) { EZSoftBoneUtility.PointInsideCylinder(ref position, ((Component)this).transform, spacing + margin); } else { EZSoftBoneUtility.PointOutsideCylinder(ref position, ((Component)this).transform, spacing + margin); } } } [CreateAssetMenu(fileName = "SBForce", menuName = "EZSoftBone/SBForce")] public class EZSoftBoneForce : ScriptableObject { public enum TurbulenceMode { Curve, Perlin } [SerializeField] private float m_Force = 1f; [SerializeField] private Vector3 m_Turbulence = new Vector3(1f, 0.5f, 2f); [SerializeField] private TurbulenceMode m_TurbulenceMode = TurbulenceMode.Perlin; [SerializeField] private Vector3 m_Frequency = new Vector3(1f, 1f, 1.5f); [SerializeField] private float m_TimeCycle = 2f; [SerializeField] [EZCurveRect(0f, -1f, 1f, 2f)] private AnimationCurve m_CurveX = AnimationCurve.Linear(0f, 0f, 1f, 1f); [SerializeField] [EZCurveRect(0f, -1f, 1f, 2f)] private AnimationCurve m_CurveY = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); [SerializeField] [EZCurveRect(0f, -1f, 1f, 2f)] private AnimationCurve m_CurveZ = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); public float force { get { return m_Force; } set { m_Force = value; } } public Vector3 turbulence { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_Turbulence; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) m_Turbulence = value; } } public TurbulenceMode turbulenceMode { get { return m_TurbulenceMode; } set { m_TurbulenceMode = value; } } public Vector3 frequency { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_Frequency; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) m_Frequency = value; } } public float timeCycle { get { return m_TimeCycle; } set { m_TimeCycle = Mathf.Max(0f, value); } } public Vector3 GetForce(float time) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) Vector3 val = turbulence; switch (turbulenceMode) { case TurbulenceMode.Curve: time = Mathf.Repeat(time, m_TimeCycle) / m_TimeCycle; val.x *= Curve(m_CurveX, time); val.y *= Curve(m_CurveY, time); val.z *= Curve(m_CurveZ, time); break; case TurbulenceMode.Perlin: val.x *= Perlin(time * frequency.x, 0f); val.y *= Perlin(time * frequency.y, 0.5f); val.z *= Perlin(time * frequency.z, 1f); break; } return new Vector3(0f, 0f, force) + val; } private float Perlin(float x, float y) { return Mathf.PerlinNoise(x, y) * 2f - 1f; } private float Curve(AnimationCurve curve, float time) { return curve.Evaluate(time); } } public class EZSoftBoneForceField : MonoBehaviour { [SerializeField] [Range(0f, 1f)] private float m_Conductivity = 0.15f; [SerializeField] [EZNestedEditor] private EZSoftBoneForce m_Force; public float conductivity { get { return m_Conductivity; } set { m_Conductivity = value; } } public EZSoftBoneForce force { get { return m_Force; } set { m_Force = value; } } public float time { get; set; } private void OnEnable() { time = 0f; } private void Update() { time += Time.deltaTime; } public Vector3 GetForce(float normalizedLength) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.TransformDirection(force.GetForce(time - conductivity * normalizedLength)); } } [CreateAssetMenu(fileName = "SBMat", menuName = "EZSoftBone/SBMaterial")] public class EZSoftBoneMaterial : ScriptableObject { [SerializeField] [Range(0f, 1f)] private float m_Damping = 0.2f; [SerializeField] [EZCurveRect(0f, 0f, 1f, 1f)] private AnimationCurve m_DampingCurve = AnimationCurve.EaseInOut(0f, 0.5f, 1f, 1f); [SerializeField] [Range(0f, 1f)] private float m_Stiffness = 0.1f; [SerializeField] [EZCurveRect(0f, 0f, 1f, 1f)] private AnimationCurve m_StiffnessCurve = AnimationCurve.Linear(0f, 1f, 1f, 1f); [SerializeField] [Range(0f, 1f)] private float m_Resistance = 0.9f; [SerializeField] [EZCurveRect(0f, 0f, 1f, 1f)] private AnimationCurve m_ResistanceCurve = AnimationCurve.Linear(0f, 1f, 1f, 0f); [SerializeField] [Range(0f, 1f)] private float m_Slackness = 0.1f; [SerializeField] [EZCurveRect(0f, 0f, 1f, 1f)] private AnimationCurve m_SlacknessCurve = AnimationCurve.Linear(0f, 1f, 1f, 0.8f); private static EZSoftBoneMaterial m_DefaultMaterial; public float damping { get { return m_Damping; } set { m_Damping = Mathf.Clamp01(value); } } public AnimationCurve dampingCurve => m_DampingCurve; public float stiffness { get { return m_Stiffness; } set { m_Stiffness = Mathf.Clamp01(value); } } public AnimationCurve stiffnessCurve => m_StiffnessCurve; public float resistance { get { return m_Resistance; } set { m_Resistance = Mathf.Clamp01(value); } } public AnimationCurve resistanceCurve => m_ResistanceCurve; public float slackness { get { return m_Slackness; } set { m_Slackness = Mathf.Clamp01(value); } } public AnimationCurve slacknessCurve => m_SlacknessCurve; public static EZSoftBoneMaterial defaultMaterial { get { if ((Object)(object)m_DefaultMaterial == (Object)null) { m_DefaultMaterial = ScriptableObject.CreateInstance<EZSoftBoneMaterial>(); } ((Object)m_DefaultMaterial).name = "SBMat_Default"; return m_DefaultMaterial; } } public float GetDamping(float t) { return damping * dampingCurve.Evaluate(t); } public float GetStiffness(float t) { return stiffness * stiffnessCurve.Evaluate(t); } public float GetResistance(float t) { return resistance * resistanceCurve.Evaluate(t); } public float GetSlackness(float t) { return slackness * slacknessCurve.Evaluate(t); } } public static class EZSoftBoneUtility { public static Vector3 Abs(this Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return new Vector3(Mathf.Abs(v.x), Mathf.Abs(v.y), Mathf.Abs(v.z)); } public static float Max(this Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Mathf.Max(v.x, Mathf.Max(v.y, v.z)); } public static bool Contains(this LayerMask mask, int layer) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return (LayerMask.op_Implicit(mask) | (1 << layer)) == LayerMask.op_Implicit(mask); } public static void GetCapsuleParams(CapsuleCollider collider, out Vector3 center0, out Vector3 center1, out float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)collider).transform.lossyScale.Abs(); radius = collider.radius; center0 = (center1 = collider.center); float num = collider.height * 0.5f; switch (collider.direction) { case 0: radius *= Mathf.Max(val.y, val.z); num = Mathf.Max(0f, num - radius / val.x); center0.x -= num; center1.x += num; break; case 1: radius *= Mathf.Max(val.x, val.z); num = Mathf.Max(0f, num - radius / val.y); center0.y -= num; center1.y += num; break; case 2: radius *= Mathf.Max(val.x, val.y); num = Mathf.Max(0f, num - radius / val.z); center0.z -= num; center1.z += num; break; } center0 = ((Component)collider).transform.TransformPoint(center0); center1 = ((Component)collider).transform.TransformPoint(center1); } public static void GetCylinderParams(Transform transform, out Vector3 center, out Vector3 direction, out float radius, out float height) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = transform.lossyScale.Abs(); center = transform.position; direction = transform.up; radius = Mathf.Max(val.x, val.z) * 0.5f; height = val.y; } public static void PointOutsideSphere(ref Vector3 position, SphereCollider collider, float spacing) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Vector3 v = ((Component)collider).transform.lossyScale.Abs(); float num = collider.radius * v.Max(); PointOutsideSphere(ref position, ((Component)collider).transform.TransformPoint(collider.center), num + spacing); } private static void PointOutsideSphere(ref Vector3 position, Vector3 spherePosition, float radius) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - spherePosition; if (((Vector3)(ref val)).magnitude < radius) { position = spherePosition + ((Vector3)(ref val)).normalized * radius; } } public static void PointInsideSphere(ref Vector3 position, SphereCollider collider, float spacing) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) PointInsideSphere(ref position, ((Component)collider).transform.TransformPoint(collider.center), collider.radius - spacing); } private static void PointInsideSphere(ref Vector3 position, Vector3 spherePosition, float radius) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - spherePosition; if (((Vector3)(ref val)).magnitude > radius) { position = spherePosition + ((Vector3)(ref val)).normalized * radius; } } public static void PointOutsideCapsule(ref Vector3 position, CapsuleCollider collider, float spacing) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetCapsuleParams(collider, out var center, out var center2, out var radius); PointOutsideCapsule(ref position, center, center2, radius + spacing); } private static void PointOutsideCapsule(ref Vector3 position, Vector3 center0, Vector3 center1, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = center1 - center0; Vector3 val2 = position - center0; float num = Vector3.Dot(val, val2); if (num <= 0f) { PointOutsideSphere(ref position, center0, radius); return; } if (num >= ((Vector3)(ref val)).sqrMagnitude) { PointOutsideSphere(ref position, center1, radius); return; } Vector3 val3 = val2 - Vector3.Project(val2, val); float num2 = radius - ((Vector3)(ref val3)).magnitude; if (num2 > 0f) { position += ((Vector3)(ref val3)).normalized * num2; } } public static void PointInsideCapsule(ref Vector3 position, CapsuleCollider collider, float spacing) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetCapsuleParams(collider, out var center, out var center2, out var radius); PointInsideCapsule(ref position, center, center2, radius - spacing); } private static void PointInsideCapsule(ref Vector3 position, Vector3 center0, Vector3 center1, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = center1 - center0; Vector3 val2 = position - center0; float num = Vector3.Dot(val, val2); if (num <= 0f) { PointInsideSphere(ref position, center0, radius); return; } if (num >= ((Vector3)(ref val)).sqrMagnitude) { PointInsideSphere(ref position, center1, radius); return; } Vector3 val3 = val2 - Vector3.Project(val2, val); float num2 = radius - ((Vector3)(ref val3)).magnitude; if (num2 < 0f) { position += ((Vector3)(ref val3)).normalized * num2; } } public static void PointOutsideCylinder(ref Vector3 position, Transform transform, float spacing) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) GetCylinderParams(transform, out var center, out var direction, out var radius, out var height); PointOutsideCylinder(ref position, center, direction, radius + spacing, height + spacing); } private static void PointOutsideCylinder(ref Vector3 position, Vector3 center, Vector3 direction, float radius, float height) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - center; Vector3 val2 = Vector3.Project(val, direction); float num = height - ((Vector3)(ref val2)).magnitude; if (!(num > 0f)) { return; } Vector3 val3 = val - val2; float num2 = radius - ((Vector3)(ref val3)).magnitude; if (num2 > 0f) { if (num2 < num) { position += ((Vector3)(ref val3)).normalized * num2; } else { position += ((Vector3)(ref val2)).normalized * num; } } } public static void PointInsideCylinder(ref Vector3 position, Transform transform, float spacing) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) GetCylinderParams(transform, out var center, out var direction, out var radius, out var height); PointInsideCylinder(ref position, center, direction, radius - spacing, height - spacing); } private static void PointInsideCylinder(ref Vector3 position, Vector3 center, Vector3 direction, float radius, float height) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - center; Vector3 val2 = Vector3.Project(val, direction); float num = height - ((Vector3)(ref val2)).magnitude; Vector3 val3 = val - val2; float num2 = radius - ((Vector3)(ref val3)).magnitude; if (num < 0f || num2 < 0f) { if (num2 < num) { position += ((Vector3)(ref val3)).normalized * num2; } else { position += ((Vector3)(ref val2)).normalized * num; } } } public static void PointOutsideBox(ref Vector3 position, BoxCollider collider, float spacing) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Vector3 position2 = ((Component)collider).transform.InverseTransformPoint(position) - collider.center; PointOutsideBox(ref position2, collider.size.Abs() / 2f + ((Component)collider).transform.InverseTransformVector(Vector3.one * spacing).Abs()); position = ((Component)collider).transform.TransformPoint(collider.center + position2); } private static void PointOutsideBox(ref Vector3 position, Vector3 boxSize) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position.Abs(); if (!(val.x < boxSize.x) || !(val.y < boxSize.y) || !(val.z < boxSize.z)) { return; } Vector3 val2 = (val - boxSize).Abs(); if (val2.x < val2.y) { if (val2.x < val2.z) { position.x = Mathf.Sign(position.x) * boxSize.x; } else { position.z = Mathf.Sign(position.z) * boxSize.z; } } else if (val2.y < val2.z) { position.y = Mathf.Sign(position.y) * boxSize.y; } else { position.z = Mathf.Sign(position.z) * boxSize.z; } } public static void PointInsideBox(ref Vector3 position, BoxCollider collider, float spacing) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Vector3 position2 = ((Component)collider).transform.InverseTransformPoint(position) - collider.center; PointInsideBox(ref position2, collider.size.Abs() / 2f - ((Component)collider).transform.InverseTransformVector(Vector3.one * spacing).Abs()); position = ((Component)collider).transform.TransformPoint(collider.center + position2); } private static void PointInsideBox(ref Vector3 position, Vector3 boxSize) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position.Abs(); if (val.x > boxSize.x) { position.x = Mathf.Sign(position.x) * boxSize.x; } if (val.y > boxSize.y) { position.y = Mathf.Sign(position.y) * boxSize.y; } if (val.z > boxSize.z) { position.z = Mathf.Sign(position.z) * boxSize.z; } } public static void PointOutsideCollider(ref Vector3 position, Collider collider, float spacing) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Vector3 val = collider.ClosestPoint(position); if (position == val) { Vector3 val2 = position; Bounds bounds = collider.bounds; Vector3 val3 = val2 - ((Bounds)(ref bounds)).center; bounds = collider.bounds; Debug.DrawLine(((Bounds)(ref bounds)).center, val, Color.red); position = val + ((Vector3)(ref val3)).normalized * spacing; } else { Vector3 val4 = position - val; if (((Vector3)(ref val4)).magnitude < spacing) { position = val + ((Vector3)(ref val4)).normalized * spacing; } } } public static void DrawGizmosArrow(Vector3 startPoint, Vector3 direction, float halfWidth, Vector3 normal) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(direction, normal); Vector3 val2 = ((Vector3)(ref val)).normalized * halfWidth; Vector3[] array = (Vector3[])(object)new Vector3[8]; array[0] = startPoint + val2 * 0.5f; array[1] = array[0] + direction * 0.5f; array[2] = array[1] + val2 * 0.5f; array[3] = startPoint + direction; array[4] = startPoint - val2 + direction * 0.5f; array[5] = array[4] + val2 * 0.5f; array[6] = startPoint - val2 * 0.5f; array[7] = array[0]; DrawGizmosPolyLine(array); } public static void DrawGizmosPolyLine(params Vector3[] vertices) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < vertices.Length - 1; i++) { Gizmos.DrawLine(vertices[i], vertices[i + 1]); } } } } namespace LethalCroc { internal class AvatarReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) string text = "LethalCrocPrefab"; GameObject obj = Assets.MainAssetBundle.LoadAsset<GameObject>(text); EZSoftBone eZSoftBone = obj.AddComponent<EZSoftBone>(); eZSoftBone.rootBones = new List<Transform>(); Transform item = obj.transform.Find("Armature.001/spine/Bone"); eZSoftBone.rootBones.Add(item); eZSoftBone.gravity = new Vector3(0f, -3f, 0f); return obj; } } [BepInPlugin("Aze.LethalCroc", "Lethal Croc", "1.0.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalCrocBase : BaseUnityPlugin { private const string modGUID = "Aze.LethalCroc"; private const string modName = "Lethal Croc"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Aze.LethalCroc"); internal ManualLogSource mls; public static ConfigFile config; private static LethalCrocBase Instance; public static ConfigEntry<bool> enableCrocForAllSuits { get; private set; } public static ConfigEntry<bool> enableCrocAsDefault { get; private set; } public static ConfigEntry<string> suitNamesToEnableCroc { get; private set; } private void Awake() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = this; } config = ((BaseUnityPlugin)this).Config; InitConfig(); Assets.PopulateAssets(); if (enableCrocForAllSuits.Value) { ModelReplacementAPI.RegisterModelReplacementOverride(typeof(AvatarReplacement)); } if (enableCrocAsDefault.Value) { ModelReplacementAPI.RegisterModelReplacementDefault(typeof(AvatarReplacement)); } string[] array = suitNamesToEnableCroc.Value.Split(','); for (int i = 0; i < array.Length; i++) { ModelReplacementAPI.RegisterSuitModelReplacement(array[i], typeof(AvatarReplacement)); } new Harmony("Aze.LethalCroc").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Aze.LethalCroc is loaded!"); } private static void InitConfig() { enableCrocForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable Croc for all Suits", false, "Enable to replace every suit with Croc. Set to false to specify suits"); enableCrocAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable Croc as default", false, "Enable to replace every suit that hasn't been otherwise registered with Croc."); suitNamesToEnableCroc = config.Bind<string>("Suits to Replace Settings", "Suits to enable Croc for", "Default,Orange suit", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])"); } } public static class Assets { public static string mainAssetBundleName = "lethalcrocbundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().GetName().Name; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName); MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }