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 RepoDisco v1.0.2
plugins/RepoDisco.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; 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 System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RepoDisco")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("RepoDisco")] [assembly: AssemblyTitle("RepoDisco")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DistractionGrenade { [DefaultExecutionOrder(30001)] public class DanceCamera : MonoBehaviour { private double startTime; private float duration; private float loopLength = 3.713f; private DanceClip clip; private Vector3 lastWrittenPos; private Quaternion lastWrittenRot; private Vector3 basePos; private Quaternion baseRot; private bool initialised; public static void Begin(float duration, double startTime, int danceId = -1) { if (Plugin.CameraMotion.Value <= 0f) { return; } Camera val = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.MainCamera : Camera.main); if (!((Object)(object)val == (Object)null)) { DanceCamera danceCamera = ((Component)val).GetComponent<DanceCamera>(); if ((Object)(object)danceCamera == (Object)null) { danceCamera = ((Component)val).gameObject.AddComponent<DanceCamera>(); } danceCamera.startTime = startTime; danceCamera.duration = duration; danceCamera.clip = DanceLibrary.Get(danceId); } } public static void Stop() { Camera val = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.MainCamera : Camera.main); DanceCamera danceCamera = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<DanceCamera>() : null); if ((Object)(object)danceCamera != (Object)null) { danceCamera.duration = -1f; } } private void LateUpdate() { //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_027a: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) double num = DanceNet.Now - startTime; if (num >= (double)duration) { Restore(); Object.Destroy((Object)(object)this); return; } if (clip == null) { clip = DanceLibrary.Builtin; } float loop = clip.Loop; float num2 = (float)(((num + (double)clip.OffsetSeconds) % (double)loop + (double)loop) % (double)loop / (double)loop) * (float)clip.FrameCount; int f0 = Mathf.FloorToInt(num2) % clip.FrameCount; int f1 = (f0 + 1) % clip.FrameCount; float ft = num2 - Mathf.Floor(num2); float num3 = Mathf.Clamp(Plugin.CameraMotion.Value, 0f, 2f); float num4 = Mathf.Clamp01((float)num / 0.5f) * Mathf.Clamp01((duration - (float)num) / 0.5f); num3 *= num4; float num5 = Ch(17) * 0.6f * num3; float num6 = Ch(18) * 0.8f * num3; float num7 = ((clip.Channels > 23) ? Ch(23) : 0f) * 0.6f * num3; float num8 = Ch(19) * 0.25f * num3; float num9 = Ch(20) * 0.6f * num3; float num10 = ((clip.Channels > 22) ? Ch(21) : 0f); float num11 = ((clip.Channels > 22) ? Ch(22) : 0f); Vector3 val = Quaternion.AngleAxis(num10, Vector3.right) * Quaternion.AngleAxis(num11, Vector3.forward) * Vector3.up; float num12 = val.z * 30f * num3; float num13 = (0f - val.x) * 30f * num3; float num14 = Mathf.DeltaAngle(0f, Ch(16)) * 0.5f * num3 * Mathf.Clamp01(val.y); Transform transform = ((Component)this).transform; Vector3 localPosition = transform.localPosition; Quaternion localRotation = transform.localRotation; if (!initialised || localPosition != lastWrittenPos) { basePos = localPosition; } if (!initialised || localRotation != lastWrittenRot) { baseRot = localRotation; } initialised = true; Vector3 val2 = (((Object)(object)transform.parent != (Object)null) ? transform.parent.InverseTransformDirection(transform.right) : transform.right); Vector3 val3 = (((Object)(object)transform.parent != (Object)null) ? transform.parent.InverseTransformDirection(Vector3.up) : Vector3.up); Vector3 val4; Vector3 val5; if (!((Object)(object)transform.parent != (Object)null)) { val4 = Vector3.ProjectOnPlane(transform.forward, Vector3.up); val5 = ((Vector3)(ref val4)).normalized; } else { Transform parent = transform.parent; val4 = Vector3.ProjectOnPlane(transform.forward, Vector3.up); val5 = parent.InverseTransformDirection(((Vector3)(ref val4)).normalized); } Vector3 val6 = val5; transform.localPosition = basePos + val2 * num5 + val3 * num6 + val6 * num7; transform.localRotation = baseRot * Quaternion.Euler(0f - num8 + num12, num14, num9 + num13); lastWrittenPos = transform.localPosition; lastWrittenRot = transform.localRotation; float Ch(int ch) { return Mathf.Lerp(clip.Ch(f0, ch), clip.Ch(f1, ch), ft); } } private void Restore() { //IL_000f: 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_0038: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (initialised) { if (((Component)this).transform.localPosition == lastWrittenPos) { ((Component)this).transform.localPosition = basePos; } if (((Component)this).transform.localRotation == lastWrittenRot) { ((Component)this).transform.localRotation = baseRot; } } } private void OnDestroy() { Restore(); } } internal static class DanceData { public const int FrameCount = 55; public const int Channels = 21; public static readonly float[] Frames = new float[1155] { 0.224f, -0.71f, 0.668f, 0.58f, -0.125f, -0.589f, 0.799f, 0.677f, -0.151f, -0.988f, 0.002f, 1f, 0.103f, -0.994f, 0.026f, 0.988f, 1.861f, -0.042f, -0.039f, 24.04f, -1.276f, 0.033f, -0.752f, 0.659f, 0.573f, 0.117f, -0.629f, 0.769f, 0.608f, -0.176f, -0.984f, 0.015f, 0.975f, 0.08f, -0.997f, 0.011f, 0.985f, -1.091f, -0.013f, -0.07f, 27.424f, -0.052f, -0.223f, -0.752f, 0.621f, 0.58f, 0.328f, -0.571f, 0.753f, 0.611f, -0.194f, -0.981f, -0.004f, 0.964f, 0.058f, -0.998f, -0.018f, 0.972f, -2.434f, 0.02f, -0.086f, 24.204f, -0.508f, -0.463f, -0.693f, 0.553f, 0.596f, 0.554f, -0.414f, 0.723f, 0.605f, -0.2f, -0.98f, -0.021f, 0.957f, 0.035f, -0.998f, -0.053f, 0.974f, -4.605f, 0.053f, -0.081f, 20.348f, -0.456f, -0.672f, -0.588f, 0.45f, 0.623f, 0.664f, -0.293f, 0.688f, 0.614f, -0.186f, -0.981f, -0.047f, 0.941f, 0.018f, -0.996f, -0.088f, 0.989f, -6.134f, 0.083f, -0.062f, 15.02f, 1.108f, -0.79f, -0.468f, 0.396f, 0.648f, 0.712f, -0.177f, 0.68f, 0.615f, -0.154f, -0.986f, -0.07f, 0.902f, 0.024f, -0.992f, -0.121f, 1f, -7.368f, 0.108f, -0.035f, 11.772f, 2.116f, -0.821f, -0.408f, 0.4f, 0.665f, 0.719f, -0.131f, 0.682f, 0.624f, -0.12f, -0.989f, -0.082f, 0.831f, 0.064f, -0.986f, -0.155f, 1f, -8.627f, 0.123f, -0.005f, 9.188f, 3.112f, -0.826f, -0.344f, 0.447f, 0.651f, 0.748f, -0.055f, 0.662f, 0.605f, -0.082f, -0.995f, -0.057f, 0.782f, 0.111f, -0.98f, -0.165f, 1f, -10.667f, 0.131f, 0.022f, 7.328f, 3.86f, -0.842f, -0.239f, 0.483f, 0.601f, 0.743f, -0.029f, 0.669f, 0.59f, -0.063f, -0.998f, -0.03f, 0.761f, 0.148f, -0.976f, -0.162f, 1f, -11.057f, 0.135f, 0.042f, 7.008f, 3.128f, -0.834f, -0.167f, 0.527f, 0.553f, 0.719f, -0.009f, 0.694f, 0.56f, -0.071f, -0.997f, 0.001f, 0.762f, 0.161f, -0.975f, -0.154f, 1f, -11.437f, 0.134f, 0.053f, 7.616f, 1.452f, -0.791f, -0.111f, 0.601f, 0.503f, 0.622f, 0.046f, 0.781f, 0.506f, -0.084f, -0.996f, 0.03f, 0.78f, 0.17f, -0.975f, -0.144f, 1f, -11.666f, 0.128f, 0.056f, 8.124f, -0.34f, -0.685f, -0.053f, 0.727f, 0.465f, 0.317f, 0.156f, 0.935f, 0.44f, -0.068f, -0.997f, 0.045f, 0.816f, 0.193f, -0.972f, -0.137f, 1f, -12.826f, 0.118f, 0.047f, 10.724f, -3.18f, -0.398f, 0.115f, 0.91f, 0.4f, -0.185f, 0.331f, 0.925f, 0.411f, -0.061f, -0.993f, 0.098f, 0.897f, 0.189f, -0.977f, -0.101f, 1f, -18.087f, 0.099f, 0.026f, 15.064f, -5.896f, 0.046f, 0.378f, 0.925f, 0.349f, -0.74f, 0.302f, 0.6f, 0.639f, -0.093f, -0.989f, 0.113f, 0.96f, 0.164f, -0.985f, -0.054f, 1f, -16.653f, 0.062f, -0.008f, 19.74f, -7.184f, 0.017f, 0.59f, 0.807f, 0.339f, -0.675f, 0.455f, 0.582f, 0.649f, -0.145f, -0.983f, 0.109f, 0.949f, 0.125f, -0.992f, -0.013f, 1f, -12.214f, 0.013f, -0.042f, 25.296f, -6.756f, 0.003f, 0.719f, 0.694f, 0.324f, -0.572f, 0.58f, 0.58f, 0.611f, -0.163f, -0.981f, 0.101f, 0.953f, 0.11f, -0.994f, 0.02f, 1f, -8.361f, -0.03f, -0.061f, 21.824f, -2.968f, -0.271f, 0.732f, 0.625f, 0.345f, -0.42f, 0.673f, 0.608f, 0.553f, -0.151f, -0.984f, 0.099f, 0.981f, 0.12f, -0.992f, 0.041f, 1f, -6.032f, -0.061f, -0.06f, 18.084f, -1.92f, -0.433f, 0.663f, 0.611f, 0.371f, -0.287f, 0.677f, 0.678f, 0.517f, -0.132f, -0.986f, 0.098f, 0.997f, 0.135f, -0.99f, 0.052f, 1f, -4.88f, -0.087f, -0.046f, 12.3f, -1.392f, -0.549f, 0.534f, 0.643f, 0.386f, -0.139f, 0.601f, 0.787f, 0.484f, -0.111f, -0.989f, 0.095f, 1f, 0.127f, -0.99f, 0.064f, 0.99f, -3.79f, -0.109f, -0.025f, 8.752f, -1.756f, -0.651f, 0.382f, 0.656f, 0.396f, -0.01f, 0.469f, 0.883f, 0.468f, -0.107f, -0.99f, 0.09f, 1f, 0.102f, -0.992f, 0.078f, 0.965f, -2.222f, -0.124f, -0.002f, 8.956f, -3.14f, -0.703f, 0.221f, 0.676f, 0.425f, 0.131f, 0.278f, 0.952f, 0.472f, -0.135f, -0.988f, 0.075f, 1f, 0.058f, -0.995f, 0.078f, 0.924f, -1.833f, -0.131f, 0.018f, 8.584f, -4.552f, -0.747f, -0.014f, 0.665f, 0.483f, 0.21f, 0.048f, 0.977f, 0.499f, -0.173f, -0.984f, 0.048f, 1f, 0.03f, -0.997f, 0.073f, 0.856f, -0.986f, -0.134f, 0.035f, 8.364f, -5.572f, -0.743f, -0.25f, 0.62f, 0.561f, 0.22f, -0.186f, 0.958f, 0.551f, -0.185f, -0.983f, 0.006f, 1f, 0.031f, -0.998f, 0.056f, 0.788f, 0.367f, -0.131f, 0.049f, 8.632f, -6.072f, -0.695f, -0.452f, 0.559f, 0.639f, 0.174f, -0.384f, 0.907f, 0.631f, -0.178f, -0.983f, -0.045f, 1f, 0.059f, -0.998f, 0.038f, 0.748f, 2.468f, -0.122f, 0.057f, 9.248f, -6.268f, -0.615f, -0.613f, 0.496f, 0.708f, 0.096f, -0.552f, 0.828f, 0.698f, -0.178f, -0.981f, -0.075f, 1f, 0.077f, -0.997f, 0.032f, 0.731f, 3.891f, -0.108f, 0.056f, 10.704f, -6.096f, -0.502f, -0.731f, 0.463f, 0.772f, 0.059f, -0.703f, 0.709f, 0.744f, -0.183f, -0.98f, -0.077f, 1f, 0.097f, -0.995f, 0.015f, 0.734f, 2.835f, -0.09f, 0.043f, 12.608f, -5.504f, -0.429f, -0.774f, 0.467f, 0.754f, 0.225f, -0.748f, 0.624f, 0.721f, -0.157f, -0.986f, -0.05f, 1f, 0.144f, -0.989f, -0.013f, 0.76f, 0.516f, -0.061f, 0.015f, 16.424f, -4.436f, -0.393f, -0.772f, 0.5f, 0.665f, 0.413f, -0.707f, 0.574f, 0.658f, -0.134f, -0.991f, -0.019f, 1f, 0.157f, -0.987f, -0.039f, 0.828f, -1.994f, -0.023f, -0.027f, 20.4f, -3.344f, -0.42f, -0.743f, 0.521f, 0.568f, 0.512f, -0.667f, 0.541f, 0.566f, -0.154f, -0.988f, 0.005f, 0.997f, 0.114f, -0.992f, -0.053f, 0.914f, -5.51f, 0.016f, -0.064f, 24.548f, -2.708f, -0.484f, -0.74f, 0.468f, 0.475f, 0.683f, -0.568f, 0.458f, 0.449f, -0.177f, -0.984f, 0.014f, 0.971f, 0.081f, -0.994f, -0.07f, 0.967f, -8.292f, 0.053f, -0.08f, 24.52f, -2.448f, -0.512f, -0.786f, 0.347f, 0.411f, 0.843f, -0.434f, 0.318f, 0.357f, -0.188f, -0.982f, 0.03f, 0.955f, 0.054f, -0.996f, -0.073f, 0.978f, -10.358f, 0.084f, -0.071f, 19.112f, -1.56f, -0.598f, -0.78f, 0.187f, 0.354f, 0.936f, -0.289f, 0.199f, 0.305f, -0.175f, -0.984f, 0.044f, 0.934f, 0.041f, -0.997f, -0.071f, 0.999f, -11.789f, 0.109f, -0.047f, 15.28f, 0.34f, -0.684f, -0.73f, 0.02f, 0.319f, 0.967f, -0.235f, 0.098f, 0.284f, -0.141f, -0.988f, 0.057f, 0.895f, 0.056f, -0.996f, -0.07f, 1f, -12.927f, 0.132f, -0.015f, 11.592f, 2.408f, -0.707f, -0.698f, -0.117f, 0.306f, 0.974f, -0.225f, -0.011f, 0.277f, -0.084f, -0.995f, 0.06f, 0.828f, 0.101f, -0.992f, -0.077f, 1f, -13.428f, 0.144f, 0.018f, 8.66f, 4.112f, -0.716f, -0.653f, -0.246f, 0.292f, 0.965f, -0.253f, -0.074f, 0.281f, -0.043f, -0.997f, 0.066f, 0.766f, 0.144f, -0.985f, -0.092f, 1f, -13.505f, 0.149f, 0.043f, 7.156f, 5.14f, -0.708f, -0.625f, -0.33f, 0.281f, 0.951f, -0.284f, -0.119f, 0.295f, -0.045f, -0.996f, 0.082f, 0.736f, 0.16f, -0.982f, -0.102f, 1f, -13.461f, 0.148f, 0.058f, 7.032f, 5.588f, -0.673f, -0.653f, -0.348f, 0.278f, 0.941f, -0.309f, -0.137f, 0.315f, -0.066f, -0.992f, 0.103f, 0.729f, 0.157f, -0.982f, -0.107f, 1f, -13.387f, 0.142f, 0.063f, 9.144f, 5.532f, -0.653f, -0.74f, -0.161f, 0.3f, 0.894f, -0.446f, -0.03f, 0.372f, -0.074f, -0.991f, 0.111f, 0.739f, 0.162f, -0.981f, -0.105f, 1f, -12.821f, 0.133f, 0.058f, 12.22f, 5.24f, -0.522f, -0.809f, 0.271f, 0.403f, 0.694f, -0.698f, 0.177f, 0.49f, -0.078f, -0.992f, 0.101f, 0.758f, 0.168f, -0.981f, -0.095f, 1f, -11.465f, 0.118f, 0.044f, 15.716f, 4.748f, -0.266f, -0.841f, 0.472f, 0.616f, 0.456f, -0.808f, 0.373f, 0.694f, -0.083f, -0.994f, 0.071f, 0.786f, 0.171f, -0.982f, -0.079f, 1f, -8.654f, 0.093f, 0.018f, 17.804f, 4.704f, -0.035f, -0.832f, 0.554f, 0.748f, 0.227f, -0.783f, 0.58f, 0.796f, -0.087f, -0.996f, 0.029f, 0.845f, 0.174f, -0.984f, -0.045f, 1f, -4.586f, 0.061f, -0.018f, 15.652f, 5.26f, 0.173f, -0.768f, 0.617f, 0.718f, -0.023f, -0.702f, 0.711f, 0.84f, -0.082f, -0.996f, 0.025f, 0.906f, 0.176f, -0.984f, 0.02f, 0.987f, 0.482f, 0.024f, -0.06f, 20.332f, 4.028f, 0.424f, -0.632f, 0.649f, 0.61f, -0.253f, -0.609f, 0.752f, 0.813f, -0.078f, -0.996f, 0.035f, 0.943f, 0.171f, -0.982f, 0.078f, 0.966f, 5.944f, -0.012f, -0.086f, 22.78f, 2.7f, 0.655f, -0.444f, 0.611f, 0.586f, -0.44f, -0.527f, 0.727f, 0.763f, -0.081f, -0.996f, 0.025f, 0.964f, 0.157f, -0.982f, 0.103f, 0.957f, 10.158f, -0.043f, -0.087f, 18.044f, 0.704f, 0.806f, -0.335f, 0.488f, 0.586f, -0.585f, -0.435f, 0.684f, 0.691f, -0.072f, -0.997f, 0.02f, 0.979f, 0.154f, -0.981f, 0.119f, 0.953f, 12.68f, -0.07f, -0.074f, 14.984f, -0.664f, 0.899f, -0.238f, 0.368f, 0.56f, -0.687f, -0.348f, 0.638f, 0.635f, -0.061f, -0.998f, 0.026f, 0.996f, 0.138f, -0.982f, 0.132f, 0.945f, 14.182f, -0.093f, -0.05f, 12.808f, -1.632f, 0.945f, -0.165f, 0.283f, 0.527f, -0.772f, -0.246f, 0.587f, 0.581f, -0.057f, -0.998f, 0.03f, 1f, 0.117f, -0.983f, 0.144f, 0.928f, 15.369f, -0.108f, -0.023f, 12.224f, -2.24f, 0.959f, -0.146f, 0.242f, 0.52f, -0.814f, -0.178f, 0.553f, 0.545f, -0.082f, -0.996f, 0.034f, 1f, 0.075f, -0.985f, 0.156f, 0.896f, 16.103f, -0.118f, 0.003f, 12.692f, -3.04f, 0.967f, -0.161f, 0.2f, 0.508f, -0.83f, -0.16f, 0.534f, 0.516f, -0.118f, -0.992f, 0.035f, 1f, 0.039f, -0.984f, 0.174f, 0.851f, 16.366f, -0.122f, 0.025f, 12.408f, -3.816f, 0.971f, -0.187f, 0.151f, 0.492f, -0.851f, -0.134f, 0.507f, 0.491f, -0.132f, -0.99f, 0.041f, 1f, 0.045f, -0.979f, 0.198f, 0.805f, 16.151f, -0.121f, 0.042f, 11.76f, -4.02f, 0.968f, -0.218f, 0.126f, 0.475f, -0.855f, -0.145f, 0.498f, 0.487f, -0.127f, -0.991f, 0.05f, 1f, 0.076f, -0.972f, 0.223f, 0.776f, 15.423f, -0.114f, 0.053f, 12.4f, -4f, 0.957f, -0.231f, 0.174f, 0.459f, -0.835f, -0.156f, 0.528f, 0.491f, -0.137f, -0.989f, 0.051f, 1f, 0.089f, -0.97f, 0.228f, 0.768f, 14.026f, -0.108f, 0.056f, 13.768f, -3.692f, 0.917f, -0.268f, 0.295f, 0.458f, -0.772f, -0.205f, 0.601f, 0.504f, -0.15f, -0.988f, 0.045f, 1f, 0.101f, -0.973f, 0.208f, 0.779f, 11.753f, -0.099f, 0.05f, 17.016f, -3.068f, 0.764f, -0.396f, 0.51f, 0.462f, -0.572f, -0.399f, 0.717f, 0.573f, -0.152f, -0.988f, 0.022f, 1f, 0.125f, -0.982f, 0.139f, 0.814f, 8.563f, -0.084f, 0.033f, 21.104f, -2.364f, 0.544f, -0.541f, 0.642f, 0.502f, -0.336f, -0.537f, 0.774f, 0.654f, -0.151f, -0.988f, 0.003f, 1f, 0.122f, -0.99f, 0.064f, 0.881f, 4.922f, -0.064f, 0.004f, 21.66f, -1.78f }; } [DefaultExecutionOrder(30000)] public class DanceDriver : MonoBehaviour { internal enum Part { None, ArmL, ArmR, LegL, LegR, Spine, Head } private class Bone { public Transform t; public Transform end; public Transform endT; public Vector3 endLocal; public Bone joint; public bool planted; public Transform ankleT; public Transform kneeT; public bool hasBind; public Vector3 bindPos; public Quaternion bindRot; public Transform bindMeshRoot; public Matrix4x4 bindWorld; public Part part; public int depth; public Quaternion baseRot; public Quaternion lastWritten; public Vector3 basePos; public Vector3 lastWrittenPos; public bool hasPos; public bool initialised; } private class RestNode { public Transform t; public Vector3 pos; public Vector3 startPos; public Quaternion rot; public Quaternion startRot; } private class Attachment { public Transform piece; public Transform anchor; public Transform rotAnchor; public Vector3 localPos; public Vector3 basePos; public Quaternion localRot; public Quaternion baseRot; } private static readonly Regex ArmRx = new Regex("arm|hand|shoulder|elbow|wrist|finger|claw|paw(?!n)|(?<!s)wing", RegexOptions.IgnoreCase); private static readonly Regex LegRx = new Regex("leg|foot|feet|thigh|knee|shin|calf|toe|ankle|hip\\.|hip_", RegexOptions.IgnoreCase); private static readonly Regex SpineRx = new Regex("spine|pelvis|hips|torso|chest|body|belly|waist", RegexOptions.IgnoreCase); private static readonly Regex FrontRx = new Regex("front|fore", RegexOptions.IgnoreCase); private static readonly Regex HeldRx = new Regex("gun|weapon|rifle|shotgun|pistol|knife|axe|sword|scythe|hammer|spear|staff|club|bat\b|wand|lantern|torch|flashlight|shield", RegexOptions.IgnoreCase); private static readonly Regex HeadRx = new Regex("head|neck|skull|jaw|face", RegexOptions.IgnoreCase); private static readonly Regex LeftRx = new Regex("(^|[^a-z])(l|left|lft)([^a-z]|$)", RegexOptions.IgnoreCase); private static readonly Regex RightRx = new Regex("(^|[^a-z])(r|right|rgt)([^a-z]|$)", RegexOptions.IgnoreCase); private static readonly Regex SkipRx = new Regex("(^|[^a-z])(ik|fx)([^a-z]|$)|target|pole|aim|look", RegexOptions.IgnoreCase); private static readonly Regex HardSkipRx = new Regex("camera|light|particle|trail|collider|trigger|audio|sound|beam|orb|spawn|debug|vacuum|teleport|effect|spark|smoke|dust|reference|marker", RegexOptions.IgnoreCase); private readonly List<Bone> bones = new List<Bone>(); private float heldFloor = float.NaN; private float heldLift = float.NaN; private bool reportedPlanted; private readonly Dictionary<Transform, Vector3> startLocalPos = new Dictionary<Transform, Vector3>(); private bool reportedMovers; private readonly List<KeyValuePair<HurtCollider, bool>> disarmed = new List<KeyValuePair<HurtCollider, bool>>(); private double lastHold = -1.0; private readonly List<RestNode> prefabRest = new List<RestNode>(); private readonly List<Attachment> attachments = new List<Attachment>(); private Transform root; private Bone fallbackBody; private float duration; private double startTime; private Enemy enemy; private PlayerAvatar player; private AudioSource music; private float loopLength = 3.713f; private DanceClip clip; private int danceId = -1; private float scale = 1f; private bool active; private int bindCount; private bool resetChecked; private bool resetAllowed = true; private Bounds restBounds; private bool silent; private bool ended; private Rigidbody frozenBody; private bool bodyWasKinematic; private Transform prefabRootCached; private bool prefabRootLooked; public static DanceDriver Begin(GameObject target, float duration, double startTime, Enemy enemy, PlayerAvatar player, int danceId = -1, bool silent = false) { if ((Object)(object)target == (Object)null) { return null; } DanceDriver danceDriver = target.GetComponent<DanceDriver>(); if ((Object)(object)danceDriver == (Object)null || danceDriver.ended) { danceDriver = target.AddComponent<DanceDriver>(); } danceDriver.danceId = danceId; danceDriver.clip = DanceLibrary.Get(danceId); danceDriver.silent = silent; danceDriver.Setup(duration, startTime, enemy, player); return danceDriver; } public void Stop() { if (active) { End(); } } private void Setup(float duration, double startTime, Enemy enemy, PlayerAvatar player) { this.duration = duration; this.startTime = startTime; this.enemy = enemy; this.player = player; root = ((Component)this).transform; if (!active) { DiscoverBones(); if (!silent) { SetupAudio(); } FreezePhysics(); Disarm(); DanceEarlyReset component = ((Component)this).GetComponent<DanceEarlyReset>(); if ((Object)(object)component == (Object)null || (Object)(object)component.driver != (Object)(object)this) { ((Component)this).gameObject.AddComponent<DanceEarlyReset>().driver = this; } active = true; } else { if ((Object)(object)music != (Object)null) { music.Stop(); Object.Destroy((Object)(object)music); music = null; } lastHold = -1.0; if (!silent) { SetupAudio(); } } } private void DiscoverBones() { //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_0029: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_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_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_12f8: Unknown result type (might be due to invalid IL or missing references) //IL_118c: Unknown result type (might be due to invalid IL or missing references) //IL_1193: Expected O, but got Unknown //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_0800: Unknown result type (might be due to invalid IL or missing references) //IL_0809: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_14ca: Unknown result type (might be due to invalid IL or missing references) //IL_14cf: Unknown result type (might be due to invalid IL or missing references) //IL_14db: Unknown result type (might be due to invalid IL or missing references) //IL_14e0: Unknown result type (might be due to invalid IL or missing references) //IL_14e7: Unknown result type (might be due to invalid IL or missing references) //IL_14ec: Unknown result type (might be due to invalid IL or missing references) //IL_14f1: Unknown result type (might be due to invalid IL or missing references) //IL_14f9: Unknown result type (might be due to invalid IL or missing references) //IL_14fe: Unknown result type (might be due to invalid IL or missing references) //IL_1506: Unknown result type (might be due to invalid IL or missing references) //IL_150b: Unknown result type (might be due to invalid IL or missing references) //IL_13ea: Unknown result type (might be due to invalid IL or missing references) //IL_13ef: Unknown result type (might be due to invalid IL or missing references) //IL_13f4: Unknown result type (might be due to invalid IL or missing references) //IL_13fc: Unknown result type (might be due to invalid IL or missing references) //IL_1401: Unknown result type (might be due to invalid IL or missing references) //IL_1408: Unknown result type (might be due to invalid IL or missing references) //IL_140d: Unknown result type (might be due to invalid IL or missing references) //IL_1412: Unknown result type (might be due to invalid IL or missing references) //IL_141a: Unknown result type (might be due to invalid IL or missing references) //IL_141f: Unknown result type (might be due to invalid IL or missing references) //IL_1427: Unknown result type (might be due to invalid IL or missing references) //IL_142c: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cd6: Unknown result type (might be due to invalid IL or missing references) //IL_0cf3: Unknown result type (might be due to invalid IL or missing references) //IL_0d04: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0948: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0d95: Unknown result type (might be due to invalid IL or missing references) //IL_0db1: Unknown result type (might be due to invalid IL or missing references) //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0dbb: Unknown result type (might be due to invalid IL or missing references) //IL_0dbc: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0958: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_0992: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_09b9: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a39: Unknown result type (might be due to invalid IL or missing references) //IL_0ea2: Unknown result type (might be due to invalid IL or missing references) //IL_0ea7: Unknown result type (might be due to invalid IL or missing references) //IL_0e65: Unknown result type (might be due to invalid IL or missing references) //IL_0e6f: Unknown result type (might be due to invalid IL or missing references) //IL_1067: Unknown result type (might be due to invalid IL or missing references) //IL_1069: Unknown result type (might be due to invalid IL or missing references) //IL_1033: Unknown result type (might be due to invalid IL or missing references) //IL_1038: Unknown result type (might be due to invalid IL or missing references) //IL_0b09: Unknown result type (might be due to invalid IL or missing references) //IL_0f5a: Unknown result type (might be due to invalid IL or missing references) //IL_0f5f: Unknown result type (might be due to invalid IL or missing references) //IL_0f78: Unknown result type (might be due to invalid IL or missing references) //IL_0f7f: Unknown result type (might be due to invalid IL or missing references) //IL_0fa3: Unknown result type (might be due to invalid IL or missing references) //IL_0fa8: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) //IL_0fb2: Unknown result type (might be due to invalid IL or missing references) //IL_0fb6: Unknown result type (might be due to invalid IL or missing references) //IL_0fb8: Unknown result type (might be due to invalid IL or missing references) //IL_0fc2: Unknown result type (might be due to invalid IL or missing references) //IL_0fdf: Unknown result type (might be due to invalid IL or missing references) //IL_0fe1: Unknown result type (might be due to invalid IL or missing references) bones.Clear(); fallbackBody = null; Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(root.position, Vector3.one * 0.5f); bool flag = false; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!(val is ParticleSystemRenderer) && !(val is TrailRenderer) && !(val is LineRenderer) && val.enabled) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } scale = Mathf.Clamp(((Bounds)(ref bounds)).size.y, 0.3f, 6f); restBounds = bounds; EnemyOverrides.Override obj = EnemyOverrides.For(enemy); Transform[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren2) { if ((Object)(object)val2 == (Object)(object)root || Already(val2) || (Object)(object)((Component)val2).GetComponent<Rigidbody>() != (Object)null || (Object)(object)((Component)val2).GetComponent<Joint>() != (Object)null) { continue; } string name = ((Object)val2).name; if (obj != null) { if (obj.Skips(val2, root)) { continue; } Part part = obj.Forced(name); if (part != Part.None) { Add(val2, part, -1); continue; } } if (name.IndexOf("armature", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("grabber", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)(object)player != (Object)null && (!name.StartsWith("ANIM ", StringComparison.Ordinal) || name.IndexOf("SCALE", StringComparison.OrdinalIgnoreCase) >= 0)) || HardSkipRx.IsMatch(name) || (SkipRx.IsMatch(name) && !ArmRx.IsMatch(name) && !LegRx.IsMatch(name))) { continue; } Part part2 = Part.None; if (ArmRx.IsMatch(name)) { if (HoldsBothSides(val2, ArmRx)) { continue; } part2 = (Side(val2, name) ? Part.ArmL : Part.ArmR); } else if (LegRx.IsMatch(name)) { if (HoldsBothSides(val2, LegRx)) { continue; } part2 = (Side(val2, name) ? Part.LegL : Part.LegR); } else if (HeadRx.IsMatch(name)) { part2 = Part.Head; } else if (SpineRx.IsMatch(name)) { part2 = Part.Spine; } if (part2 != Part.None) { Add(val2, part2, -1); } } bool flag2 = false; bool flag3 = false; foreach (Bone bone3 in bones) { if (bone3.part == Part.ArmL || bone3.part == Part.ArmR) { flag2 = true; } else if ((bone3.part == Part.LegL || bone3.part == Part.LegR) && FrontRx.IsMatch(((Object)bone3.t).name)) { flag3 = true; } } if (!flag2 && flag3) { foreach (Bone bone4 in bones) { if ((bone4.part == Part.LegL || bone4.part == Part.LegR) && FrontRx.IsMatch(((Object)bone4.t).name)) { bone4.part = ((bone4.part == Part.LegL) ? Part.ArmL : Part.ArmR); } } } GeometricPass(); RerootDetachedLimbs(); foreach (Bone bone5 in bones) { if (bone5.depth >= 0) { continue; } int num = 0; Transform parent = bone5.t.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)root) { Bone bone = Find(parent); if (bone != null && bone.part == bone5.part) { num++; } parent = parent.parent; } bone5.depth = num; } foreach (Bone bone6 in bones) { Bone bone2 = bone6; if (bone2.depth != 0 || !IsLimb(bone2.part)) { continue; } Vector3 rootPos = bone2.t.position; List<Bone> joints = new List<Bone>(); foreach (Bone bone7 in bones) { if (bone7 != bone2 && bone7.part == bone2.part && bone7.t.IsChildOf(bone2.t) && HasMeshOutside(bone2.t, bone7.t)) { joints.Add(bone7); } } float best = 0.02f * scale; float bestBalance = float.MaxValue; bone2.endT = null; bone2.joint = null; componentsInChildren2 = ((Component)bone2.t).GetComponentsInChildren<Transform>(false); foreach (Transform val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)(object)bone2.t) && !HardSkipRx.IsMatch(((Object)val3).name) && !SkipRx.IsMatch(((Object)val3).name) && !UnderHeld(val3, bone2.t)) { Consider(val3, Vector3.zero); } } MeshFilter[] componentsInChildren3 = ((Component)bone2.t).GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val4 in componentsInChildren3) { if ((Object)(object)val4.sharedMesh == (Object)null) { continue; } Renderer component = ((Component)val4).GetComponent<Renderer>(); if (!((Object)(object)component == (Object)null) && component.enabled && !SkipRx.IsMatch(((Object)((Component)val4).transform).name) && !HardSkipRx.IsMatch(((Object)((Component)val4).transform).name) && ((Object)((Component)val4).transform).name.IndexOf("map", StringComparison.OrdinalIgnoreCase) < 0 && !UnderHeld(((Component)val4).transform, bone2.t)) { Bounds bounds2 = val4.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Consider(((Component)val4).transform, ((Bounds)(ref bounds2)).center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3((float)((j & 1) * 2 - 1), (float)(((j >> 1) & 1) * 2 - 1), (float)(((j >> 2) & 1) * 2 - 1)))); } } } bone2.end = bone2.endT; if ((Object)(object)bone2.endT == (Object)null) { continue; } Vector3 val5 = EndPos(bone2); Bone joint = null; int num2 = int.MaxValue; foreach (Bone item in joints) { if ((Object)(object)bone2.endT == (Object)(object)item.t || !bone2.endT.IsChildOf(item.t)) { continue; } float num3 = Vector3.Distance(item.t.position, rootPos); float num4 = Vector3.Distance(val5, item.t.position); float num5 = num3 + num4; if (!(num3 < 0.15f * num5) && !(num4 < 0.15f * num5)) { int num6 = HierarchyDepth(item.t); if (num6 < num2) { num2 = num6; joint = item; } } } bone2.joint = joint; Transform val6 = obj?.EndNodeFor(bone2.t, ((Object)bone2.t).name); if ((Object)(object)val6 != (Object)null && (Object)(object)val6 != (Object)(object)bone2.t && val6.IsChildOf(bone2.t)) { bone2.endT = val6; bone2.endLocal = Vector3.zero; bone2.end = val6; MeshFilter component2 = ((Component)val6).GetComponent<MeshFilter>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.sharedMesh != (Object)null) { Vector3 val7 = BodyReference(); Bounds bounds3 = component2.sharedMesh.bounds; float num7 = float.PositiveInfinity; for (int k = 0; k < 8; k++) { Vector3 val8 = ((Bounds)(ref bounds3)).center + Vector3.Scale(((Bounds)(ref bounds3)).extents, new Vector3((float)((k & 1) * 2 - 1), (float)(((k >> 1) & 1) * 2 - 1), (float)(((k >> 2) & 1) * 2 - 1))); float num8 = Vector3.Distance(val6.TransformPoint(val8), val7); if (num8 < num7) { num7 = num8; bone2.endLocal = val8; } } if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)$"[Dance] {bone2.part}: end mesh {((Object)val6).name}, corner nearest the body (body y={val7.y:F2}) at y={EndPos(bone2).y:F2}, pivot y={bone2.t.position.y:F2}"); } } bool flag4 = (bone2.part == Part.LegL || bone2.part == Part.LegR) && EndPos(bone2).y > bone2.t.position.y + 0.05f; if (flag4) { bone2.planted = true; bone2.joint = null; bone2.hasPos = true; } if (flag4 && obj.BendKnee) { List<Transform> list = new List<Transform>(); Transform parent2 = val6.parent; while ((Object)(object)parent2 != (Object)null && (Object)(object)parent2 != (Object)(object)bone2.t) { bool flag5 = false; foreach (Transform item2 in parent2) { if ((Object)(object)((Component)item2).GetComponent<MeshFilter>() != (Object)null) { flag5 = true; break; } } if (flag5) { list.Insert(0, parent2); } parent2 = parent2.parent; } if (list.Count == 2) { bone2.ankleT = list[0]; bone2.kneeT = list[1]; } if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)string.Format("[Dance] {0}: knee bend {1}", bone2.part, ((Object)(object)bone2.kneeT != (Object)null) ? ("ankle " + ((Object)bone2.ankleT).name + ", knee " + ((Object)bone2.kneeT).name) : $"not possible ({list.Count} segment nodes)")); } } if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)string.Format("[Dance] {0}: end forced to {1}{2}", bone2.part, ((Object)val6).name, flag4 ? " (foot pivot)" : "")); } continue; } if (bone2.part != Part.LegL && bone2.part != Part.LegR) { continue; } int num9; object obj2; if (Vector3.Distance(PrefabTwin(bone2.t).position, PrefabTwin(bone2.endT).position) < 0.05f) { num9 = ((Vector3.Distance(bone2.t.position, bone2.endT.position) > 0.2f) ? 1 : 0); if (num9 != 0) { obj2 = (Func<Transform, Transform>)((Transform x) => x); goto IL_0d48; } } else { num9 = 0; } obj2 = new Func<Transform, Transform>(PrefabTwin); goto IL_0d48; IL_0d48: Func<Transform, Transform> func = (Func<Transform, Transform>)obj2; if (num9 != 0 && Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)$"[Dance] {bone2.part}: prefab chain collapsed, judging on the live pose."); } Vector3 position = func(bone2.t).position; Vector3 val9 = func(bone2.endT).TransformPoint(bone2.endLocal); float num10 = Vector3.Distance(val9, position); if (!(val9.y > position.y + 0.2f * num10)) { continue; } Transform val10 = null; float num11 = float.NegativeInfinity; componentsInChildren2 = ((Component)bone2.t).GetComponentsInChildren<Transform>(false); foreach (Transform val11 in componentsInChildren2) { if (!((Object)(object)val11 == (Object)(object)bone2.t) && !HardSkipRx.IsMatch(((Object)val11).name) && !SkipRx.IsMatch(((Object)val11).name) && !UnderHeld(val11, bone2.t)) { float num12 = func(val11).position.y - position.y; if (num12 > num11) { num11 = num12; val10 = val11; } } } float num13 = float.NegativeInfinity; Transform val12 = null; Vector3 endLocal = Vector3.zero; componentsInChildren3 = ((Component)bone2.t).GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val13 in componentsInChildren3) { if ((Object)(object)val13.sharedMesh == (Object)null || UnderHeld(((Component)val13).transform, bone2.t)) { continue; } Renderer component3 = ((Component)val13).GetComponent<Renderer>(); if ((Object)(object)component3 == (Object)null || !component3.enabled || HardSkipRx.IsMatch(((Object)((Component)val13).transform).name) || SkipRx.IsMatch(((Object)((Component)val13).transform).name)) { continue; } Bounds bounds4 = val13.sharedMesh.bounds; Transform val14 = func(((Component)val13).transform); for (int num14 = 0; num14 < 8; num14++) { Vector3 val15 = ((Bounds)(ref bounds4)).center + Vector3.Scale(((Bounds)(ref bounds4)).extents, new Vector3((float)((num14 & 1) * 2 - 1), (float)(((num14 >> 1) & 1) * 2 - 1), (float)(((num14 >> 2) & 1) * 2 - 1))); float num15 = val14.TransformPoint(val15).y - position.y; if (num15 > num13) { num13 = num15; val12 = ((Component)val13).transform; endLocal = val15; } } } if ((Object)(object)val10 != (Object)null && num11 >= 0.6f * num13 && num11 > 0.01f) { bone2.endT = val10; bone2.endLocal = Vector3.zero; } else if ((Object)(object)val12 != (Object)null && num13 > 0.01f) { bone2.endT = val12; bone2.endLocal = endLocal; } bone2.end = bone2.endT; bone2.planted = true; bone2.joint = null; bone2.hasPos = true; void Consider(Transform endT, Vector3 val24) { //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_0008: 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_0048: 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_009b: 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_00ad: 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_013c: 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) Vector3 val23 = endT.TransformPoint(val24); float num18 = Vector3.Distance(val23, rootPos); if (num18 > best + 0.0001f) { best = num18; bestBalance = float.MaxValue; bone2.endT = endT; bone2.endLocal = val24; bone2.joint = null; } foreach (Bone item3 in joints) { if (!((Object)(object)endT == (Object)(object)item3.t) && endT.IsChildOf(item3.t)) { float num19 = Vector3.Distance(item3.t.position, rootPos); float num20 = Vector3.Distance(val23, item3.t.position); float num21 = num19 + num20; if (!(num19 < 0.15f * num21) && !(num20 < 0.15f * num21)) { float num22 = Mathf.Abs(num19 - num20); if (num21 > best + 0.0001f || (Mathf.Abs(num21 - best) <= 0.0001f && num22 < bestBalance)) { best = num21; bestBalance = num22; bone2.endT = endT; bone2.endLocal = val24; bone2.joint = item3; } } } } } } if ((Object)(object)enemy != (Object)null) { PromoteBodyRoot(); } bones.Sort((Bone a, Bone b) => HierarchyDepth(a.t).CompareTo(HierarchyDepth(b.t))); bool flag6 = false; foreach (Bone bone8 in bones) { if (bone8.part == Part.ArmL || bone8.part == Part.ArmR || bone8.part == Part.LegL || bone8.part == Part.LegR) { flag6 = true; } } if (!flag6) { Transform val16 = null; int num16 = 0; foreach (Transform item4 in root) { Transform val17 = item4; if ((Object)(object)((Component)val17).GetComponent<Rigidbody>() != (Object)null) { continue; } int num17 = 0; componentsInChildren = ((Component)val17).GetComponentsInChildren<Renderer>(); foreach (Renderer val18 in componentsInChildren) { if (val18.enabled && (val18 is MeshRenderer || val18 is SkinnedMeshRenderer)) { num17++; } } if (num17 != 0) { if ((Object)(object)((Component)val17).GetComponentInChildren<Animator>(true) != (Object)null || (Object)(object)((Component)val17).GetComponentInChildren<Animation>(true) != (Object)null) { num17 += 1000; } if (num17 > num16) { num16 = num17; val16 = val17; } } } if ((Object)(object)val16 == (Object)null && (Object)(object)((Component)root).GetComponent<Rigidbody>() == (Object)null) { val16 = root; } if ((Object)(object)val16 != (Object)null) { fallbackBody = new Bone { t = val16, part = Part.Spine, depth = 0, hasPos = true }; if (Find(val16) == null) { bones.Add(fallbackBody); } } } if (Plugin.DebugLogBones.Value) { startLocalPos.Clear(); componentsInChildren2 = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val19 in componentsInChildren2) { startLocalPos[val19] = val19.localPosition; } } prefabRest.Clear(); if ((Object)(object)enemy != (Object)null && Plugin.RigidRestPose.Value && bindCount == 0) { CollectPrefabRest(); } attachments.Clear(); if (obj != null && obj.Attach.Count > 0) { componentsInChildren2 = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val20 in componentsInChildren2) { string text = obj.AnchorFor(((Object)val20).name); if (text != null) { Transform val21 = EnemyOverrides.FindNamed(root, text); if (!((Object)(object)val21 == (Object)null) && !((Object)(object)val21 == (Object)(object)val20) && !val21.IsChildOf(val20)) { attachments.Add(new Attachment { piece = val20, anchor = val21, localPos = val21.InverseTransformPoint(val20.position), localRot = Quaternion.Inverse(val21.rotation) * val20.rotation, basePos = val20.localPosition, baseRot = val20.localRotation }); } } } } if (obj != null && obj.Level != null) { componentsInChildren2 = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val22 in componentsInChildren2) { if (obj.Level.IsMatch(((Object)val22).name) && !((Object)(object)val22.parent == (Object)null)) { attachments.Add(new Attachment { piece = val22, anchor = val22.parent, rotAnchor = root, localPos = val22.localPosition, localRot = Quaternion.Inverse(root.rotation) * val22.rotation, basePos = val22.localPosition, baseRot = val22.localRotation }); } } } if (!Plugin.DebugLogBones.Value) { return; } string text2 = ((!((Object)(object)enemy != (Object)null)) ? (((Object)(object)player != (Object)null) ? "player" : ((Object)root).name) : (enemy.EnemyParent?.enemyName ?? ((Object)enemy).name)); if ((Object)(object)enemy != (Object)null) { text2 = text2 + " [" + EnemyOverrides.Key(enemy) + ((obj != null) ? ", override" : "") + "] root=" + ((Object)root).name; } Plugin.Log.LogDebug((object)$"[Dance] {text2}: {bones.Count} bones, limbs={flag6}, height={scale:F2}"); foreach (Bone bone9 in bones) { string text3 = ""; if (bone9.depth == 0 && IsLimb(bone9.part)) { text3 = (((Object)(object)bone9.endT == (Object)null) ? " NO END" : (" end=" + ((Object)bone9.endT).name + ((bone9.joint != null) ? (" joint=" + ((Object)bone9.joint.t).name) : "") + (bone9.planted ? " PLANTED" : ""))); } Plugin.Log.LogDebug((object)$"[Dance] {bone9.part} d{bone9.depth} {Path(bone9.t)}{text3}"); } } private void GeometricPass() { //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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00d7: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { if ((Object)(object)val.sharedMesh == (Object)null || val.bones == null) { continue; } Matrix4x4[] bindposes = val.sharedMesh.bindposes; Transform[] array = val.bones; int num = Mathf.Min(bindposes.Length, array.Length); if (num < 4) { continue; } Dictionary<Transform, Vector3> dictionary = new Dictionary<Transform, Vector3>(); Dictionary<Transform, Matrix4x4> dictionary2 = new Dictionary<Transform, Matrix4x4>(); float num2 = float.PositiveInfinity; float num3 = float.NegativeInfinity; float num4 = 0f; for (int j = 0; j < num; j++) { if (!((Object)(object)array[j] == (Object)null) && !dictionary.ContainsKey(array[j])) { Matrix4x4 inverse = ((Matrix4x4)(ref bindposes[j])).inverse; Vector3 val2 = Vector4.op_Implicit(((Matrix4x4)(ref inverse)).GetColumn(3)); dictionary[array[j]] = val2; dictionary2[array[j]] = inverse; num2 = Mathf.Min(num2, val2.y); num3 = Mathf.Max(num3, val2.y); num4 += val2.x; } } float num5 = num3 - num2; if (dictionary.Count < 4 || num5 <= 0.001f) { continue; } float num6 = num4 / (float)dictionary.Count; float num7 = 0.03f * num5; float num8 = 0f; int num9 = 0; foreach (KeyValuePair<Transform, Vector3> item in dictionary) { if (Mathf.Abs(item.Value.x - num6) <= num7) { num8 += item.Value.y; num9++; } } num8 = ((num9 > 0) ? (num8 / (float)num9) : (num2 + 0.5f * num5)); foreach (KeyValuePair<Transform, Vector3> item2 in dictionary) { Transform key = item2.Key; if ((Object)(object)key == (Object)(object)root || Already(key) || (Object)(object)((Component)key).GetComponent<Rigidbody>() != (Object)null || (Object)(object)((Component)key).GetComponent<Joint>() != (Object)null || ((Object)key).name.IndexOf("armature", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } Transform val3 = null; Transform val4 = key; while ((Object)(object)val4 != (Object)null && dictionary.ContainsKey(val4)) { if (Mathf.Abs(dictionary[val4].x - num6) > num7) { val3 = val4; } val4 = val4.parent; } Part part; if ((Object)(object)val3 == (Object)null) { float y = item2.Value.y; if (y > num2 + 0.8f * num5) { bool flag = false; Transform[] componentsInChildren2 = ((Component)key).GetComponentsInChildren<Transform>(true); foreach (Transform val5 in componentsInChildren2) { if ((Object)(object)val5 != (Object)(object)key && dictionary.TryGetValue(val5, out var value) && Mathf.Abs(value.x - num6) > num7) { flag = true; break; } } part = (flag ? Part.Spine : Part.Head); } else { if (!(y > num2 + 0.25f * num5)) { continue; } part = Part.Spine; } } else { bool flag2 = dictionary[val3].x < num6; part = ((!(dictionary[val3].y > num8)) ? (flag2 ? Part.LegL : Part.LegR) : (flag2 ? Part.ArmL : Part.ArmR)); } Add(key, part, -1); } Matrix4x4 localToWorldMatrix = ((Component)val).transform.localToWorldMatrix; foreach (KeyValuePair<Transform, Matrix4x4> item3 in dictionary2) { Transform key2 = item3.Key; if ((Object)(object)key2 == (Object)(object)root || (Object)(object)key2.parent == (Object)null || (Object)(object)((Component)key2).GetComponent<Rigidbody>() != (Object)null || (Object)(object)((Component)key2).GetComponent<Joint>() != (Object)null) { continue; } Bone bone = Find(key2); if (bone == null) { bone = new Bone { t = key2, part = Part.None, depth = 0 }; bones.Add(bone); } Matrix4x4 value2; bool flag3 = dictionary2.TryGetValue(key2.parent, out value2); Matrix4x4 val6 = (flag3 ? (((Matrix4x4)(ref value2)).inverse * item3.Value) : (key2.parent.worldToLocalMatrix * localToWorldMatrix * item3.Value)); Vector3 val7 = Vector4.op_Implicit(((Matrix4x4)(ref val6)).GetColumn(3)); Quaternion rotation = ((Matrix4x4)(ref val6)).rotation; if (!Finite(val7) || !Finite(rotation) || Mathf.Abs(((Matrix4x4)(ref val6)).determinant) < 1E-09f || ((Matrix4x4)(ref val6)).determinant < 0f) { if (Plugin.DebugLogBones.Value) { Plugin.Log.LogWarning((object)$"[Dance] no usable bind pose for {((Object)key2).name} (det {((Matrix4x4)(ref val6)).determinant:G3})"); } continue; } bone.bindPos = val7; bone.bindRot = Quaternion.Normalize(rotation); bone.hasBind = true; bone.hasPos = true; if (!flag3) { bone.bindMeshRoot = ((Component)val).transform; bone.bindWorld = item3.Value; } bindCount++; } } } private static bool IsLimb(Part p) { if (p != Part.ArmL && p != Part.ArmR && p != Part.LegL) { return p == Part.LegR; } return true; } private static Vector3 EndPos(Bone b) { //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) return b.endT.TransformPoint(b.endLocal); } private static Vector3 FootPos(Bone b) { //IL_0015: 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) if (!b.planted) { return EndPos(b); } return b.t.position; } private static Vector3 TwoBone(Bone root, Vector3 dir, float reach, Vector3 pole, float blend, Vector3 up, Vector3 fwd) { //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_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_001e: 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_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0053: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0083: 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_00ce: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00ef: 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_00f1: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_017d: 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_0193: 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_019d: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) //IL_01a8: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0136: Unknown result type (might be due to invalid IL or missing references) Vector3 position = root.t.position; Vector3 position2 = root.joint.t.position; Vector3 val = EndPos(root); float num = Vector3.Distance(position2, position); float num2 = Vector3.Distance(val, position2); float num3 = num + num2; if (num < 0.05f * num3 || num2 < 0.05f * num3) { Vector3 val2 = val - position; if (((Vector3)(ref val2)).sqrMagnitude > 1E-08f) { root.t.rotation = Quaternion.Slerp(Quaternion.identity, Quaternion.FromToRotation(((Vector3)(ref val2)).normalized, dir), blend) * root.t.rotation; } return position + dir * num3; } float num4 = Mathf.Clamp(reach * num3, Mathf.Abs(num - num2) + 0.0001f, num3 - 0.0001f); Vector3 val3 = position + dir * num4; Vector3 val4 = (val3 - position) / num4; Vector3 val5 = pole - Vector3.Dot(pole, val4) * val4; if (((Vector3)(ref val5)).sqrMagnitude < 1E-06f) { val5 = Vector3.Cross(val4, up); } if (((Vector3)(ref val5)).sqrMagnitude < 1E-06f) { val5 = Vector3.Cross(val4, fwd); } ((Vector3)(ref val5)).Normalize(); float num5 = Mathf.Clamp((num * num + num4 * num4 - num2 * num2) / (2f * num * num4), -1f, 1f); float num6 = Mathf.Sqrt(1f - num5 * num5); Vector3 val6 = position + val4 * (num * num5) + val5 * (num * num6); Quaternion val7 = Quaternion.FromToRotation(position2 - position, val6 - position); root.t.rotation = Quaternion.Slerp(Quaternion.identity, val7, blend) * root.t.rotation; Vector3 position3 = root.joint.t.position; Quaternion val8 = Quaternion.FromToRotation(EndPos(root) - position3, val3 - position3); root.joint.t.rotation = Quaternion.Slerp(Quaternion.identity, val8, blend) * root.joint.t.rotation; return val3; } private static bool Finite(Vector3 v) { //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) //IL_001a: 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_0034: 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) if (!float.IsNaN(v.x) && !float.IsNaN(v.y) && !float.IsNaN(v.z) && !float.IsInfinity(v.x) && !float.IsInfinity(v.y)) { return !float.IsInfinity(v.z); } return false; } private static bool Finite(Quaternion q) { //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) //IL_001a: 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_0034: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0055: 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_0063: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(q.x) && !float.IsNaN(q.y) && !float.IsNaN(q.z) && !float.IsNaN(q.w)) { return Mathf.Abs(q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w) > 1E-06f; } return false; } private Bounds VisibleBounds() { //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) //IL_0079: 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_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) Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(root.position, Vector3.zero); bool flag = false; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!(val is ParticleSystemRenderer) && !(val is TrailRenderer) && !(val is LineRenderer) && val.enabled) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } return bounds; } private static int HierarchyDepth(Transform t) { int num = 0; while ((Object)(object)t != (Object)null && (Object)(object)t.parent != (Object)null) { num++; t = t.parent; } return num; } private static Transform Farthest(Transform t) { //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_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) Transform result = null; float num = 0f; Vector3 position = t.position; Transform[] componentsInChildren = ((Component)t).GetComponentsInChildren<Transform>(false); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)(object)t) && !HardSkipRx.IsMatch(((Object)val).name) && !SkipRx.IsMatch(((Object)val).name)) { float num2 = Vector3.Distance(val.position, position); if (num2 > num) { num = num2; result = val; } } } return result; } private void Add(Transform t, Part part, int depth) { if (!Already(t)) { bones.Add(new Bone { t = t, part = part, depth = depth, hasPos = (part == Part.Spine) }); } } private bool Already(Transform t) { return Find(t) != null; } private Bone Find(Transform t) { foreach (Bone bone in bones) { if ((Object)(object)bone.t == (Object)(object)t) { return bone; } } return null; } private static bool HoldsBothSides(Transform t, Regex limb) { bool flag = false; bool flag2 = false; Transform[] componentsInChildren = ((Component)t).GetComponentsInChildren<Transform>(false); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)(object)t) && limb.IsMatch(((Object)val).name)) { if (LeftRx.IsMatch(((Object)val).name)) { flag = true; } if (RightRx.IsMatch(((Object)val).name)) { flag2 = true; } if (flag && flag2) { return true; } } } return false; } private bool Side(Transform t, string name) { //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) bool flag = LeftRx.IsMatch(name); bool flag2 = RightRx.IsMatch(name); if (flag && !flag2) { return true; } if (flag2 && !flag) { return false; } return root.InverseTransformPoint(t.position).x < 0f; } private static string Path(Transform t) { string text = ((Object)t).name; int num = 0; while ((Object)(object)t.parent != (Object)null && num++ < 12) { t = t.parent; text = ((Object)t).name + "/" + text; } return text; } private void FreezePhysics() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)enemy == (Object)null) && Plugin.FreezePhysics.Value && enemy.HasRigidbody && !((Object)(object)enemy.Rigidbody == (Object)null) && !((Object)(object)enemy.Rigidbody.rb == (Object)null)) { frozenBody = enemy.Rigidbody.rb; bodyWasKinematic = frozenBody.isKinematic; if (!bodyWasKinematic) { frozenBody.linearVelocity = Vector3.zero; frozenBody.angularVelocity = Vector3.zero; frozenBody.isKinematic = true; } } } private void Disarm() { disarmed.Clear(); if (!((Object)(object)enemy == (Object)null)) { HurtCollider[] componentsInChildren = ((Component)(((Object)(object)enemy.EnemyParent != (Object)null) ? ((Component)enemy.EnemyParent).transform : ((Component)enemy).transform.root)).GetComponentsInChildren<HurtCollider>(true); foreach (HurtCollider val in componentsInChildren) { disarmed.Add(new KeyValuePair<HurtCollider, bool>(val, val.playerLogic)); val.playerLogic = false; } } } private void Rearm() { foreach (KeyValuePair<HurtCollider, bool> item in disarmed) { if ((Object)(object)item.Key != (Object)null) { item.Key.playerLogic = item.Value; } } disarmed.Clear(); } private void HoldEachFrame(double elapsed) { if ((Object)(object)enemy == (Object)null || !SemiFunc.IsMasterClientOrSingleplayer() || (elapsed - lastHold < 0.5 && lastHold >= 0.0)) { return; } lastHold = elapsed; float num = (float)((double)duration - elapsed) + 0.5f; if (num <= 0f) { return; } if (enemy.HasStateStunned && (Object)(object)enemy.StateStunned != (Object)null) { enemy.StateStunned.Set(num); if (enemy.StateStunned.stunTimer < num) { enemy.StateStunned.stunTimer = num; } } else { enemy.Freeze(num); } if (enemy.HasNavMeshAgent && (Object)(object)enemy.NavMeshAgent != (Object)null) { enemy.NavMeshAgent.Stop(0.2f); } } private void ThawPhysics() { if ((Object)(object)frozenBody != (Object)null) { frozenBody.isKinematic = bodyWasKinematic; frozenBody = null; } } internal void RestoreBase() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0063: 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_007c: Unknown result type (might be due to invalid IL or missing references) foreach (Bone bone in bones) { if (!((Object)(object)bone.t == (Object)null) && bone.initialised) { if (bone.t.localRotation == bone.lastWritten) { bone.t.localRotation = bone.baseRot; } if (bone.hasPos && bone.t.localPosition == bone.lastWrittenPos) { bone.t.localPosition = bone.basePos; } } } } private Vector3 BodyReference() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) Bounds bounds; foreach (Bone bone in bones) { if (bone.part == Part.Spine && !((Object)(object)bone.t == (Object)null)) { Renderer component = ((Component)bone.t).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { bounds = component.bounds; return ((Bounds)(ref bounds)).center; } } } foreach (Bone bone2 in bones) { if (bone2.part == Part.Spine && !((Object)(object)bone2.t == (Object)null)) { Renderer componentInChildren = ((Component)bone2.t).GetComponentInChildren<Renderer>(); if ((Object)(object)componentInChildren != (Object)null && !IsLimbName(((Object)((Component)componentInChildren).transform).name)) { bounds = componentInChildren.bounds; return ((Bounds)(ref bounds)).center; } } } return root.position; } private static bool IsLimbName(string n) { if (n.IndexOf("arm", StringComparison.OrdinalIgnoreCase) < 0 && n.IndexOf("leg", StringComparison.OrdinalIgnoreCase) < 0) { return n.IndexOf("foot", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private void PromoteBodyRoot() { List<Bone> list = new List<Bone>(); List<Bone> list2 = new List<Bone>(); foreach (Bone bone2 in bones) { if (bone2.depth == 0 && !((Object)(object)bone2.t == (Object)null)) { if (bone2.part == Part.Spine) { list.Add(bone2); } else if (bone2.part == Part.Head || (IsLimb(bone2.part) && (Object)(object)bone2.endT != (Object)null && (Object)(object)bone2.endT != (Object)(object)bone2.t)) { list2.Add(bone2); } } } EnemyOverrides.Override obj = EnemyOverrides.For(enemy); Transform val = ((obj != null && obj.Body != null) ? EnemyOverrides.FindNamed(root, obj.Body) : null); Transform val2; if ((Object)(object)val != (Object)null) { val2 = val; } else { if (list.Count == 0 || list2.Count == 0) { return; } bool flag = false; foreach (Bone item in list2) { bool flag2 = false; foreach (Bone item2 in list) { if (item.t.IsChildOf(item2.t)) { flag2 = true; break; } } if (!flag2) { flag = true; break; } } if (!flag) { return; } val2 = list[0].t; foreach (Bone item3 in list) { val2 = CommonAncestor(val2, item3.t); } foreach (Bone item4 in list2) { val2 = CommonAncestor(val2, item4.t); } } if ((Object)(object)val2 == (Object)null || (!((Object)(object)val2 == (Object)(object)root) && !val2.IsChildOf(root)) || (Object)(object)((Component)val2).GetComponent<Rigidbody>() != (Object)null) { return; } foreach (Bone item5 in list) { if ((Object)(object)item5.t != (Object)(object)val2) { item5.depth = 1; } } Bone bone = Find(val2); if (bone != null) { bone.part = Part.Spine; bone.depth = 0; bone.hasPos = true; } else { bones.Add(new Bone { t = val2, part = Part.Spine, depth = 0, hasPos = true }); } if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)("[Dance] body root promoted to " + ((Object)val2).name + " (limbs or head were outside the spine)")); } } private Transform PrefabTwin(Transform t) { if ((Object)(object)t == (Object)null || (Object)(object)enemy == (Object)null) { return t; } Transform val = FindPrefabRoot(); if ((Object)(object)val == (Object)null) { return t; } Transform val2 = Twin(root, t, val); if (!((Object)(object)val2 != (Object)null)) { return t; } return val2; } private Transform FindPrefabRoot() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefabRootCached != (Object)null) { return prefabRootCached; } if (prefabRootLooked) { return null; } prefabRootLooked = true; Transform top = (((Object)(object)enemy.EnemyParent != (Object)null) ? ((Component)enemy.EnemyParent).transform : ((Component)enemy).transform.root); string text = EnemyOverrides.Key(enemy); GameObject val = null; EnemyParent[] array = Resources.FindObjectsOfTypeAll<EnemyParent>(); foreach (EnemyParent val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } Scene scene = ((Component)val2).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { string name = ((Object)((Component)val2).gameObject).name; if (name == text || name == "Enemy - " + text) { val = ((Component)val2).gameObject; break; } } } if ((Object)(object)val == (Object)null) { if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)("[Dance] no prefab asset found for " + text + "; measuring on the live pose.")); } return null; } prefabRootCached = Twin(top, root, val.transform); return prefabRootCached; } private void CollectPrefabRest() { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) Transform val = FindPrefabRoot(); if ((Object)(object)val == (Object)null) { return; } GameObject gameObject = ((Component)val.root).gameObject; HashSet<Transform> hashSet = new HashSet<Transform>(); foreach (Bone bone in bones) { if (!((Object)(object)bone.t == (Object)null) && (bone.part == Part.Spine || bone.part == Part.Head)) { Transform val2 = bone.t; while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)root) { hashSet.Add(val2); val2 = val2.parent; } } } Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if ((Object)(object)val3 == (Object)(object)root || HardSkipRx.IsMatch(((Object)val3).name) || (Object)(object)((Component)val3).GetComponent<Rigidbody>() != (Object)null || (Object)(object)((Component)val3).GetComponent<Joint>() != (Object)null) { continue; } bool flag = ((Object)val3).name.IndexOf("code", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)val3).name.IndexOf("aim", StringComparison.OrdinalIgnoreCase) >= 0; if (hashSet.Contains(val3) || flag) { Transform val4 = Twin(root, val3, val); if (!((Object)(object)val4 == (Object)null)) { prefabRest.Add(new RestNode { t = val3, pos = val3.localPosition, rot = val4.localRotation, startPos = val3.localPosition, startRot = val3.localRotation }); } } } if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)$"[Dance] prefab rest pose: {prefabRest.Count} nodes from \"{((Object)gameObject).name}\"."); } } private static Transform Twin(Transform top, Transform t, Transform otherTop) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown List<Transform> list = new List<Transform>(); Transform val = t; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)top) { list.Add(val); val = val.parent; } if (list.Count > 0 && (Object)(object)list[list.Count - 1].parent != (Object)(object)top) { return null; } list.Reverse(); Transform val2 = otherTop; foreach (Transform item in list) { int siblingIndex = item.GetSiblingIndex(); Transform val3 = ((siblingIndex < val2.childCount && ((Object)val2.GetChild(siblingIndex)).name == ((Object)item).name) ? val2.GetChild(siblingIndex) : null); if ((Object)(object)val3 == (Object)null) { foreach (Transform item2 in val2) { Transform val4 = item2; if (((Object)val4).name == ((Object)item).name) { val3 = val4; break; } } } if ((Object)(object)val3 == (Object)null) { return null; } val2 = val3; } return val2; } private void RerootDetachedLimbs() { //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) EnemyOverrides.Override obj = EnemyOverrides.For(enemy); if (obj != null && obj.NoReroot) { return; } Transform prefabRoot = (((Object)(object)enemy != (Object)null) ? FindPrefabRoot() : null); List<Bone> list = new List<Bone>(); foreach (Bone bone3 in bones) { if (!IsLimb(bone3.part)) { continue; } bool flag = false; Transform parent = bone3.t.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)root) { Bone bone = Find(parent); if (bone != null && bone.part == bone3.part) { flag = true; break; } parent = parent.parent; } if (!flag) { list.Add(bone3); } } foreach (Bone item in list) { Transform val = P(item.t); List<Vector3> list2 = MeshCorners(val); if (list2.Count == 0) { continue; } float num = 0f; foreach (Vector3 item2 in list2) { num = Mathf.Max(num, Vector3.Distance(item2, val.position)); } Transform val2 = FirstMeshNode(val); if ((Object)(object)val2 == (Object)null) { continue; } float num2 = float.MaxValue; foreach (Vector3 item3 in MeshCorners(val2, selfOnly: true)) { num2 = Mathf.Min(num2, Vector3.Distance(item3, val.position)); } if (num < 0.0001f || num2 <= 0.25f * num) { continue; } Bone bone2 = null; int num3 = int.MaxValue; foreach (Bone bone4 in bones) { if (bone4 == item || bone4.part != item.part || !bone4.t.IsChildOf(item.t)) { continue; } Transform val3 = P(bone4.t); List<Vector3> list3 = MeshCorners(val3); if (list3.Count == 0) { continue; } float num4 = float.MaxValue; foreach (Vector3 item4 in list3) { num4 = Mathf.Min(num4, Vector3.Distance(item4, val3.position)); } if (!(num4 > 0.25f * num)) { int num5 = HierarchyDepth(bone4.t); if (num5 < num3) { num3 = num5; bone2 = bone4; } } } if (bone2 != null) { bones.Remove(item); if (Plugin.DebugLogBones.Value) { Plugin.Log.LogDebug((object)$"[Dance] limb re-rooted: {((Object)item.t).name} is {num2:F2} m from its mesh, driving {((Object)bone2.t).name} instead"); } } } Transform P(Transform t) { if ((Object)(object)prefabRoot == (Object)null) { return t; } Transform val4 = Twin(root, t, prefabRoot); if (!((Object)(object)val4 != (Object)null)) { return t; } return val4; } } private static bool UnderHeld(Transform t, Transform limb) { Transform val = t; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)limb) { if (HeldRx.IsMatch(((Object)val).name)) { return true; } val = val.parent; } return false; } private static Transform FirstMeshNode(Transform t) { Transform result = null; int num = int.MaxValue; MeshFilter[] componentsInChildren = ((Component)t).GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val in componentsInChildren) { if ((Object)(object)val.sharedMesh == (Object)null) { continue; } Renderer component = ((Component)val).GetComponent<Renderer>(); if (!((Object)(object)component == (Object)null) && component.enabled && !HardSkipRx.IsMatch(((Object)((Component)val).transform).name) && !SkipRx.IsMatch(((Object)((Component)val).transform).name) && !UnderHeld(((Component)val).transform, t)) { int num2 = HierarchyDepth(((Component)val).transform); if (num2 < num) { num = num2; result = ((Component)val).transform; } } } return result; } private static List<Vector3> MeshCorners(Transform t, bool selfOnly = false) { //IL_00a7: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) List<Vector3> list = new List<Vector3>(); MeshFilter[] componentsInChildren = ((Component)t).GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val in componentsInChildren) { if ((selfOnly && (Object)(object)((Component)val).transform != (Object)(object)t) || (Object)(object)val.sharedMesh == (Object)null || UnderHeld(((Component)val).transform, t)) { continue; } Renderer component = ((Component)val).GetComponent<Renderer>(); if (!((Object)(object)component == (Object)null) && component.enabled && !HardSkipRx.IsMatch(((Object)((Component)val).transform).name) && !SkipRx.IsMatch(((Object)((Component)val).transform).name)) { Bounds bounds = val.sharedMesh.bounds; for (int j = 0; j < 8; j++) { list.Add(((Component)val).transform.TransformPoint(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)((j & 1) * 2 - 1), (float)(((j >> 1) & 1) * 2 - 1), (float)(((j >> 2) & 1) * 2 - 1))))); } } } return list; } private static bool HasMeshOutside(Transform limb, Transform joint) { bool flag = false; Renderer[] componentsInChildren = ((Component)limb).GetComponentsInChildren<Renderer>(false); foreach (Renderer val in componentsInChildren) { if (val.enabled && (val is MeshRenderer || val is SkinnedMeshRenderer)) { flag = true; if (!((Component)val).transform.IsChildOf(joint)) { return true; } } } return !flag; } private Vector3 TumbleAbout(Vector3 rootPos, Quaternion tumble) { //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_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_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_001a: Unknown result type (might be due to invalid IL or missing references) Vector3 center = ((Bounds)(ref restBounds)).center; return center + tumble * (rootPos - center); } private static Transform CommonAncestor(Transform a, Transform b) { Transform val = a; while ((Object)(object)val != (Object)null) { if (b.IsChildOf(val)) { return val; } val = val.parent; } return null; } private void SetupAudio() { if (clip == null) { clip = DanceLibrary.Builtin; } if ((Object)(object)clip.Music == (Object)null) { DanceLibrary.Prefetch(danceId); ((MonoBehaviour)this).StartCoroutine(StartMusicWhenLoaded()); } else { StartMusic(); } } private IEnumerator StartMusicWhenLoaded() { float waited = 0f; while ((Object)(object)clip.Music == (Object)null && waited < 8f && active) { waited += Time.deltaTime; yield return null; } if ((Object)(object)clip.Music != (Object)null && active && (Object)(object)music == (Object)null) { StartMusic(); } }