Decompiled source of Dynamic Bones P6 v1.7.0
Mods/DynamicBonesBL.dll
Decompiled 2 weeks 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 BONELABTemplate; using DynamicBonesFusion; using FieldInjector; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.VRMK; using Il2CppSystem; using LabFusion.SDK.Modules; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "DynamicBonesLoader", "0.2.5", "Coolkidstan", "https://thunderstore.io/c/bonelab/p/CoolkidStan/Dynamic_Bones_P6")] [assembly: MelonGame("StressLevelZero", "Bonelab")] [assembly: MelonOptionalDependencies(new string[] { "LabFusion" })] [assembly: AssemblyTitle("A loader for dynamic bones scripts.")] [assembly: AssemblyDescription("A loader for dynamic bones scripts.")] [assembly: AssemblyCompany("Coolio Corp & Subsidary")] [assembly: AssemblyProduct("DynamicBonesLoader")] [assembly: AssemblyCopyright("Developed by Coolkidstan")] [assembly: AssemblyTrademark("Coolio Corp & Subsidary")] [assembly: AssemblyFileVersion("0.2.5")] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.2.5.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } public class BonelabDynamicBoneManager { private List<DynamicBone> m_AvatarBones = new List<DynamicBone>(); private List<MapDbone> m_MapBones = new List<MapDbone>(); private float m_LastOptimizationTime; private const float OPTIMIZATION_INTERVAL = 2f; public void Initialize() { MelonLogger.Msg("[MapBone] Initializing Dynamic Bone Manager..."); ProcessAllDynamicBones(); MelonLogger.Msg($"[MapBone] Found {m_AvatarBones.Count} avatar bones and {m_MapBones.Count} map bones"); } public void ProcessAllDynamicBones() { m_AvatarBones.Clear(); m_MapBones.Clear(); MapDboneModDetection.CategorizeAllDynamicBones(out m_AvatarBones, out m_MapBones); ProcessAvatarBones(); ProcessMapBones(); MapDboneModDetection.LogAllDynamicBones(); } private void ProcessAvatarBones() { foreach (DynamicBone avatarBone in m_AvatarBones) { if (avatarBone.m_BlendWeight < 1f) { avatarBone.m_BlendWeight = 1f; } MelonLogger.Msg("[AvatarBone] Configured: " + ((Object)avatarBone).name); } } private void OptimizePhysicsForPlayer(DynamicBone bone) { if (bone.m_UpdateRate < 72f) { bone.m_UpdateRate = 72f; } if (bone.m_Damping < 0.25f) { bone.m_Damping = 0.25f; } if (bone.m_Elasticity < 0.08f) { bone.m_Elasticity = 0.08f; } if (bone.m_Stiffness < 0.08f) { bone.m_Stiffness = 0.08f; } if (bone.m_Inert < 0.2f) { bone.m_Inert = 0.2f; } } private void ProcessMapBones() { foreach (MapDbone mapBone in m_MapBones) { HandleMapDynamicBone(mapBone); } } private void HandleMapDynamicBone(MapDbone mapBone) { MelonLogger.Msg("[MapBone] Processing: " + ((Object)mapBone).name); MelonLogger.Msg($" Mode: {mapBone.m_RigMode}"); ConfigureMapBoneSettings(mapBone); } private void ConfigureMapBoneSettings(MapDbone mapBone) { mapBone.m_DistantDisable = true; mapBone.m_DistanceToObject = 30f; switch (mapBone.m_RigMode) { case MapDbone.RigMode.Hierarchy: mapBone.m_UpdateRate = 45f; break; case MapDbone.RigMode.PhantomRig: mapBone.m_UpdateRate = 30f; break; case MapDbone.RigMode.Automatic: mapBone.m_UpdateRate = 60f; break; } ApplyNameBasedSettings(mapBone); } private void ApplyNameBasedSettings(MapDbone mapBone) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)mapBone).name.ToLower(); if (text.Contains("flag") || text.Contains("banner")) { mapBone.m_Force = new Vector3(0.5f, 0f, 0.3f); mapBone.m_Damping = 0.1f; mapBone.m_Elasticity = 0.8f; } else if (text.Contains("chain") || text.Contains("rope")) { mapBone.m_Gravity = new Vector3(0f, -15f, 0f); mapBone.m_Damping = 0.2f; mapBone.m_Elasticity = 0.3f; } else if (text.Contains("hair") || text.Contains("fur")) { mapBone.m_Gravity = new Vector3(0f, -5f, 0f); mapBone.m_Damping = 0.05f; mapBone.m_Elasticity = 0.9f; } else if (text.Contains("cloth") || text.Contains("fabric")) { mapBone.m_Gravity = new Vector3(0f, -9.81f, 0f); mapBone.m_Damping = 0.15f; mapBone.m_Elasticity = 0.6f; } } public void Update() { if (Time.time - m_LastOptimizationTime > 2f) { OptimizePerformance(); m_LastOptimizationTime = Time.time; } } public void OptimizePerformance() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { int num = MapDboneModDetection.OptimizeMapBonesByDistance(((Component)main).transform.position); if (num > 0) { MelonLogger.Msg($"[MapBone] Optimized {num} map bones based on distance"); } MaintainAvatarBoneQuality(); } } private void MaintainAvatarBoneQuality() { foreach (DynamicBone avatarBone in m_AvatarBones) { if (!((Object)(object)avatarBone == (Object)null)) { if (!((Behaviour)avatarBone).enabled) { ((Behaviour)avatarBone).enabled = true; } if (avatarBone.m_BlendWeight < 1f) { avatarBone.m_BlendWeight = 1f; } } } } public void DisableAllMapBones() { foreach (MapDbone mapBone in m_MapBones) { if ((Object)(object)mapBone != (Object)null) { ((Behaviour)mapBone).enabled = false; } } MelonLogger.Msg($"[MapBone] Disabled {m_MapBones.Count} map bones"); } public void EnableAllMapBones() { foreach (MapDbone mapBone in m_MapBones) { if ((Object)(object)mapBone != (Object)null) { ((Behaviour)mapBone).enabled = true; } } MelonLogger.Msg($"[MapBone] Enabled {m_MapBones.Count} map bones"); } public void LogPerformanceStats() { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (MapDbone mapBone in m_MapBones) { if (!((Object)(object)mapBone == (Object)null)) { if (((Behaviour)mapBone).enabled) { num++; } else { num2++; } if (mapBone.m_RigMode == MapDbone.RigMode.Hierarchy) { num3++; } else if (mapBone.m_RigMode == MapDbone.RigMode.PhantomRig) { num4++; } } } MelonLogger.Msg("=== Dynamic Bone Performance Stats ==="); MelonLogger.Msg($"Avatar Bones: {m_AvatarBones.Count} (always enabled)"); MelonLogger.Msg($"Map Bones Total: {m_MapBones.Count}"); MelonLogger.Msg($" Enabled: {num}"); MelonLogger.Msg($" Disabled: {num2}"); MelonLogger.Msg($" Hierarchy Mode: {num3}"); MelonLogger.Msg($" Phantom Mode: {num4}"); } public void ConfigureMapBonesByNamePattern(string namePattern, Action<MapDbone> configAction) { List<MapDbone> list = MapDboneModDetection.FindMapBonesByNamePattern(namePattern); foreach (MapDbone item in list) { configAction?.Invoke(item); } MelonLogger.Msg($"[MapBone] Configured {list.Count} bones with name pattern '{namePattern}'"); } } public class DynamicBone : MonoBehaviour { public enum UpdateMode { Normal, AnimatePhysics, UnscaledTime, Default } public enum FreezeAxis { None, X, Y, Z } private class Particle { public Transform m_Transform; public int m_ParentIndex; public int m_ChildCount; public float m_Damping; public float m_Elasticity; public float m_Stiffness; public float m_Inert; public float m_Friction; public float m_Radius; public float m_BoneLength; public bool m_isCollide; public bool m_TransformNotNull; public Vector3 m_Position; public Vector3 m_PrevPosition; public Vector3 m_EndOffset; public Vector3 m_InitLocalPosition; public Quaternion m_InitLocalRotation; public Vector3 m_TransformPosition; public Vector3 m_TransformLocalPosition; public Matrix4x4 m_TransformLocalToWorldMatrix; public Vector3 m_SmoothedPosition; public Quaternion m_SmoothedRotation; public bool m_SmoothingInitialized; public Vector3 m_Velocity; public Vector3 m_PrevFramePosition; public Vector3[] m_PositionHistory; public Quaternion[] m_RotationHistory; public int m_HistoryWriteIndex; public bool m_HistoryInitialized; } private class ParticleTree { public Transform m_Root; public Vector3 m_LocalGravity; public Matrix4x4 m_RootWorldToLocalMatrix; public float m_BoneTotalLength; public List<Particle> m_Particles = new List<Particle>(); public Vector3 m_RestGravity; } private RigManager m_RigManager; private bool m_IsHookedToRig; private Mirror m_ParentMirror; private DynamicBone m_MirrorReflectionBone; public Transform m_Root; public List<Transform> m_Roots; public float m_UpdateRate = 60f; public UpdateMode m_UpdateMode = UpdateMode.Default; public float m_Damping = 0.1f; public AnimationCurve m_DampingDistrib; public float m_Elasticity = 0.1f; public AnimationCurve m_ElasticityDistrib; public float m_Stiffness = 0.1f; public AnimationCurve m_StiffnessDistrib; public float m_Inert; public AnimationCurve m_InertDistrib; public float m_Friction; public AnimationCurve m_FrictionDistrib; public float m_Radius; public AnimationCurve m_RadiusDistrib; public float m_EndLength; public Vector3 m_EndOffset = Vector3.zero; public Vector3 m_Gravity = Vector3.zero; public Vector3 m_Force = Vector3.zero; public float m_BlendWeight = 1f; public List<DynamicBoneColliderBase> m_Colliders; public List<Transform> m_Exclusions; public FreezeAxis m_FreezeAxis; public bool m_DistantDisable; public Transform m_ReferenceObject; public float m_DistanceToObject = 20f; public bool m_Multithread = true; public bool m_EnableSmoothing; public float m_SmoothingStrength = 0.2f; public bool m_AutoDetectPlayerBone = true; public bool m_UseUnityModePhysics; public bool m_UseAdaptiveSmoothing = true; public float m_MaxPositionDelta = 0.5f; public float m_ConstraintSoftness = 0.35f; public int m_ConstraintIterations = 3; public bool m_UseTemporalSmoothing = true; public int m_TemporalBufferSize = 4; public bool m_DebugLogging; private float m_LastLogTime; public bool m_IsPlayerBone; private float m_UnityModeMultiplier = 1f; private Vector3 m_ObjectMove; private Vector3 m_ObjectPrevPosition; private float m_ObjectScale; private float m_Time; private float m_Weight = 1f; private bool m_DistantDisabled; private int m_PreUpdateCount; private List<ParticleTree> m_ParticleTrees = new List<ParticleTree>(); private float m_DeltaTime; private List<DynamicBoneColliderBase> m_EffectiveColliders; private static int s_UpdateCount; private static int s_PrepareFrame; private static HashSet<Mirror> s_KnownMirrors = new HashSet<Mirror>(); private bool m_IsMirrorClone; private Vector3 m_MirrorPlaneNormal = Vector3.forward; public static void ClearKnownMirrors() { s_KnownMirrors.Clear(); MelonLogger.Msg("[DynamicBone] Cleared known mirrors registry"); } private void Start() { //IL_0064: 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) if (DetectMirrorReflection()) { m_IsMirrorClone = true; FindOriginalDynamicBone(); SetupParticles(); return; } if (m_AutoDetectPlayerBone) { DetectPlayerBone(); } TryHookToRigManager(); if (((Vector3)(ref m_Gravity)).magnitude == 0f && ((Vector3)(ref m_Force)).magnitude == 0f) { m_Gravity = new Vector3(0f, -9.81f, 0f); } SetupParticles(); RegisterForMirrorCopying(); } private void FindOriginalDynamicBone() { try { if ((Object)(object)m_ParentMirror == (Object)null) { m_ParentMirror = ((Component)((Component)this).transform).GetComponentInParent<Mirror>(); } if ((Object)(object)m_ParentMirror == (Object)null) { if (s_KnownMirrors.Count == 0) { Il2CppArrayBase<Mirror> val = Object.FindObjectsOfType<Mirror>(); if (val != null) { foreach (Mirror item in val) { if ((Object)(object)item != (Object)null) { s_KnownMirrors.Add(item); } } } } if (s_KnownMirrors.Count > 0) { foreach (Mirror s_KnownMirror in s_KnownMirrors) { if ((Object)(object)s_KnownMirror != (Object)null) { m_ParentMirror = s_KnownMirror; break; } } } } if ((Object)(object)m_ParentMirror == (Object)null) { return; } if ((Object)(object)m_ParentMirror.rigManager == (Object)null) { Avatar componentInParent = ((Component)((Component)this).transform).GetComponentInParent<Avatar>(); if (!((Object)(object)componentInParent != (Object)null)) { return; } string text = ((Object)((Component)componentInParent).gameObject).name.Replace("(Clone)", "").Trim(); try { Il2CppArrayBase<RigManager> val2 = Object.FindObjectsOfType<RigManager>(); RigManager val3 = null; if (val2 == null) { return; } foreach (RigManager item2 in val2) { if (!((Object)(object)item2 != (Object)null) || !((Object)(object)item2._avatar != (Object)null)) { continue; } string name = ((Object)((Component)item2._avatar).gameObject).name; bool flag = false; Transform val4 = ((Component)item2).transform; while ((Object)(object)val4 != (Object)null) { string text2 = ((Object)val4).name.ToLower(); if (text2.Contains("reflection") || text2 == "avatars") { flag = true; break; } val4 = val4.parent; } if (!flag) { Transform val5 = ((Component)item2._avatar).transform; while ((Object)(object)val5 != (Object)null) { string text3 = ((Object)val5).name.ToLower(); if (text3.Contains("reflection") || text3 == "avatars") { flag = true; break; } val5 = val5.parent; } } if (!flag) { if (name == text || name.Contains(text) || text.Contains(name.Replace("(Clone)", "").Trim())) { val3 = item2; break; } if ((Object)(object)val3 == (Object)null) { val3 = item2; } } } if (!((Object)(object)val3 != (Object)null)) { return; } foreach (DynamicBone componentsInChild in ((Component)val3._avatar).GetComponentsInChildren<DynamicBone>()) { if (((Object)((Component)componentsInChild).gameObject).name == ((Object)((Component)this).gameObject).name && !componentsInChild.m_IsMirrorClone) { m_MirrorReflectionBone = componentsInChild; break; } } return; } catch (Exception) { return; } } Avatar avatar = m_ParentMirror.rigManager._avatar; if ((Object)(object)avatar == (Object)null) { return; } foreach (DynamicBone componentsInChild2 in ((Component)avatar).GetComponentsInChildren<DynamicBone>()) { if (((Object)((Component)componentsInChild2).gameObject).name == ((Object)((Component)this).gameObject).name && !componentsInChild2.m_IsMirrorClone) { m_MirrorReflectionBone = componentsInChild2; break; } } } catch (Exception) { } } private string GetRelativePathFromAvatar(Transform t) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null && !((Object)(object)((Component)parent).GetComponent<Avatar>() != (Object)null)) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private void RegisterForMirrorCopying() { _ = m_IsMirrorClone; } private bool DetectMirrorReflection() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_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) Mirror componentInParent = ((Component)((Component)this).transform).GetComponentInParent<Mirror>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.Reflection != (Object)null && ((Component)this).transform.IsChildOf(((Component)componentInParent.Reflection).transform)) { m_IsMirrorClone = true; m_ParentMirror = componentInParent; return true; } Transform val = ((Component)this).transform; while ((Object)(object)val != (Object)null) { string text = ((Object)val).name.ToLower(); if (text.Contains("clone") && text.Contains("(")) { Transform parent = val.parent; while ((Object)(object)parent != (Object)null) { string text2 = ((Object)parent).name.ToLower(); if (text2 == "avatars" || text2.Contains("reflection")) { m_IsMirrorClone = true; m_MirrorPlaneNormal = val.forward; if ((Object)(object)m_ParentMirror == (Object)null) { Mirror componentInParent2 = ((Component)parent).GetComponentInParent<Mirror>(); if ((Object)(object)componentInParent2 != (Object)null) { m_ParentMirror = componentInParent2; } } return true; } parent = parent.parent; } } if (text.Contains("mirror") && (text.Contains("reflection") || text.Contains("clone") || text.Contains("avatars"))) { m_IsMirrorClone = true; m_MirrorPlaneNormal = val.forward; if ((Object)(object)m_ParentMirror == (Object)null) { Transform val2 = val; while ((Object)(object)val2 != (Object)null) { Mirror componentInParent3 = ((Component)val2).GetComponentInParent<Mirror>(); if ((Object)(object)componentInParent3 != (Object)null) { m_ParentMirror = componentInParent3; break; } val2 = val2.parent; } } return true; } if (text.Contains("_reflecttran") || text.Contains("reflectionplane")) { m_IsMirrorClone = true; if ((Object)(object)m_ParentMirror == (Object)null) { Mirror componentInParent4 = ((Component)val).GetComponentInParent<Mirror>(); if ((Object)(object)componentInParent4 != (Object)null) { m_ParentMirror = componentInParent4; } } return true; } if (text == "reflection" || text == "avatars") { Transform parent2 = val.parent; while ((Object)(object)parent2 != (Object)null) { if (((Object)parent2).name.ToLower().Contains("reflection")) { m_IsMirrorClone = true; if ((Object)(object)m_ParentMirror == (Object)null) { Mirror componentInParent5 = ((Component)parent2).GetComponentInParent<Mirror>(); if ((Object)(object)componentInParent5 != (Object)null) { m_ParentMirror = componentInParent5; } } return true; } parent2 = parent2.parent; } } val = val.parent; } return false; } private void TryHookToRigManager() { if (!m_IsPlayerBone) { return; } Transform val = ((Component)this).transform; while ((Object)(object)val != (Object)null) { m_RigManager = ((Component)val).GetComponent<RigManager>(); if ((Object)(object)m_RigManager != (Object)null) { HookToRigManager(); break; } val = val.parent; } _ = (Object)(object)m_RigManager == (Object)null; } private void HookToRigManager() { if ((Object)(object)m_RigManager == (Object)null || m_IsHookedToRig) { return; } try { RigManager rigManager = m_RigManager; rigManager.OnPostLateUpdate += Action.op_Implicit((Action)OnRigPostLateUpdate); m_IsHookedToRig = true; } catch (Exception ex) { MelonLogger.Error("[DynamicBone] Failed to hook to RigManager: " + ex.Message); } } private void UnhookFromRigManager() { if ((Object)(object)m_RigManager != (Object)null && m_IsHookedToRig) { try { RigManager rigManager = m_RigManager; rigManager.OnPostLateUpdate -= Action.op_Implicit((Action)OnRigPostLateUpdate); m_IsHookedToRig = false; } catch (Exception ex) { MelonLogger.Error("[DynamicBone] Failed to unhook from RigManager: " + ex.Message); } } } private void OnRigPostLateUpdate() { PerformLateUpdateLogic(); } private void DetectPlayerBone() { Transform val = ((Component)this).transform; while ((Object)(object)val != (Object)null) { string text = ((Object)val).name.ToLower(); if (text.Contains("player") || text.Contains("localplayer") || text.Contains("[rigmanager]") || text.Contains("playerroot") || text.Contains("playerrig") || text.Contains("[physicsrig]")) { m_IsPlayerBone = true; if (!m_EnableSmoothing) { m_EnableSmoothing = true; } break; } if ((Object)(object)((Component)val).GetComponent<MapDboneMarker>() != (Object)null) { m_IsPlayerBone = false; break; } val = val.parent; } } private void FixedUpdate() { if (m_UpdateMode == UpdateMode.AnimatePhysics) { PreUpdate(); } } private void Update() { if (m_UpdateMode != UpdateMode.AnimatePhysics) { PreUpdate(); } s_UpdateCount++; } private void LateUpdate() { if (!m_IsHookedToRig) { PerformLateUpdateLogic(); } } private void PerformLateUpdateLogic() { if (m_PreUpdateCount == 0) { return; } if (s_UpdateCount > 0) { s_UpdateCount = 0; s_PrepareFrame++; } SetWeight(m_BlendWeight); if (m_IsMirrorClone) { CopyFromOriginalDynamicBone(); m_PreUpdateCount = 0; return; } CheckDistance(); if (IsNeedUpdate()) { Prepare(); UpdateParticles(); if (!IsRigManagedBone()) { ApplyParticlesToTransforms(); } else { MelonLogger.Warning("[DynamicBone] Skipping transform manipulation for rig-managed bone: " + ((Object)this).name + ". Use Marrow APIs instead."); } } m_PreUpdateCount = 0; } private void CopyFromOriginalDynamicBone() { //IL_00bf: 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) if ((Object)(object)m_MirrorReflectionBone == (Object)null) { FindOriginalDynamicBone(); if ((Object)(object)m_MirrorReflectionBone == (Object)null) { return; } } if (m_ParticleTrees == null || m_ParticleTrees.Count == 0 || m_MirrorReflectionBone.m_ParticleTrees == null || m_MirrorReflectionBone.m_ParticleTrees.Count == 0) { return; } for (int i = 0; i < m_ParticleTrees.Count && i < m_MirrorReflectionBone.m_ParticleTrees.Count; i++) { ParticleTree particleTree = m_ParticleTrees[i]; ParticleTree particleTree2 = m_MirrorReflectionBone.m_ParticleTrees[i]; for (int j = 0; j < particleTree.m_Particles.Count && j < particleTree2.m_Particles.Count; j++) { Particle particle = particleTree.m_Particles[j]; Particle particle2 = particleTree2.m_Particles[j]; if (particle.m_TransformNotNull && particle2.m_TransformNotNull) { particle.m_Transform.localPosition = particle2.m_Transform.localPosition; particle.m_Transform.localRotation = particle2.m_Transform.localRotation; } } } } private Vector3 ReflectPositionAcrossMirror(Vector3 position) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_ParentMirror != (Object)null && (Object)(object)m_ParentMirror._reflectTran != (Object)null) { Transform reflectTran = m_ParentMirror._reflectTran; Vector3 forward = reflectTran.forward; Vector3 val = position - reflectTran.position; val = Vector3.Reflect(val, forward); return reflectTran.position + val; } return position - 2f * Vector3.Dot(position, m_MirrorPlaneNormal) * m_MirrorPlaneNormal; } private Quaternion ReflectRotationAcrossMirror(Quaternion rotation) { //IL_005e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) //IL_0056: 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_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_ParentMirror != (Object)null && (Object)(object)m_ParentMirror._reflectTran != (Object)null) { Vector3 forward = m_ParentMirror._reflectTran.forward; Vector3 val = rotation * Vector3.forward; Vector3 val2 = rotation * Vector3.up; Vector3 val3 = Vector3.Reflect(val, forward); val2 = Vector3.Reflect(val2, forward); return Quaternion.LookRotation(val3, val2); } return rotation; } private bool IsRigManagedBone() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_RigManager != (Object)null && (Object)(object)m_Root != (Object)null && (Object)(object)m_RigManager._avatar != (Object)null) { Animator animator = m_RigManager._avatar.animator; foreach (HumanBodyBones value in Enum.GetValues(typeof(HumanBodyBones))) { if ((int)value != 55) { Transform boneTransform = animator.GetBoneTransform(value); if ((Object)(object)boneTransform != (Object)null && ((Object)(object)boneTransform == (Object)(object)m_Root || m_Root.IsChildOf(boneTransform))) { return true; } } } } return false; } private void Prepare() { //IL_0012: 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_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) m_DeltaTime = Time.deltaTime; m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ObjectMove = ((Component)this).transform.position - m_ObjectPrevPosition; m_ObjectPrevPosition = ((Component)this).transform.position; for (int i = 0; i < m_ParticleTrees.Count; i++) { ParticleTree particleTree = m_ParticleTrees[i]; particleTree.m_RestGravity = particleTree.m_LocalGravity; for (int j = 0; j < particleTree.m_Particles.Count; j++) { Particle particle = particleTree.m_Particles[j]; if (particle.m_TransformNotNull) { particle.m_TransformPosition = particle.m_Transform.position; particle.m_TransformLocalPosition = particle.m_Transform.localPosition; particle.m_TransformLocalToWorldMatrix = particle.m_Transform.localToWorldMatrix; } } } if (m_EffectiveColliders != null) { m_EffectiveColliders.Clear(); } if (m_Colliders == null) { return; } for (int k = 0; k < m_Colliders.Count; k++) { DynamicBoneColliderBase dynamicBoneColliderBase = m_Colliders[k]; if ((Object)(object)dynamicBoneColliderBase != (Object)null && ((Behaviour)dynamicBoneColliderBase).enabled) { if (m_EffectiveColliders == null) { m_EffectiveColliders = new List<DynamicBoneColliderBase>(); } m_EffectiveColliders.Add(dynamicBoneColliderBase); if (dynamicBoneColliderBase.PrepareFrame != s_PrepareFrame) { dynamicBoneColliderBase.Prepare(); dynamicBoneColliderBase.PrepareFrame = s_PrepareFrame; } } } } private bool IsNeedUpdate() { if (m_Weight > 0f) { if (m_DistantDisable) { return !m_DistantDisabled; } return true; } return false; } private void PreUpdate() { if (IsNeedUpdate()) { InitTransforms(); } m_PreUpdateCount++; } private void CheckDistance() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!m_DistantDisable) { return; } Transform val = m_ReferenceObject; if ((Object)(object)val == (Object)null && (Object)(object)Camera.main != (Object)null) { val = ((Component)Camera.main).transform; } if (!((Object)(object)val != (Object)null)) { return; } Vector3 val2 = val.position - ((Component)this).transform.position; bool flag = ((Vector3)(ref val2)).sqrMagnitude > m_DistanceToObject * m_DistanceToObject; if (flag != m_DistantDisabled) { if (!flag) { ResetParticlesPosition(); } m_DistantDisabled = flag; } } private void OnEnable() { if (!m_IsMirrorClone && DetectMirrorReflection()) { m_IsMirrorClone = true; FindOriginalDynamicBone(); } if (!m_IsMirrorClone && m_IsPlayerBone && (Object)(object)m_RigManager != (Object)null && !m_IsHookedToRig) { HookToRigManager(); } ResetParticlesPosition(); } private void OnDisable() { UnhookFromRigManager(); InitTransforms(); } private void OnDestroy() { UnhookFromRigManager(); } private void OnValidate() { m_UpdateRate = Mathf.Max(m_UpdateRate, 0f); m_Damping = Mathf.Clamp01(m_Damping); m_Elasticity = Mathf.Clamp01(m_Elasticity); m_Stiffness = Mathf.Clamp01(m_Stiffness); m_Inert = Mathf.Clamp01(m_Inert); m_Friction = Mathf.Clamp01(m_Friction); m_Radius = Mathf.Max(m_Radius, 0f); m_SmoothingStrength = Mathf.Clamp01(m_SmoothingStrength); m_MaxPositionDelta = Mathf.Max(m_MaxPositionDelta, 0.01f); m_ConstraintSoftness = Mathf.Clamp01(m_ConstraintSoftness); if (Application.isEditor && Application.isPlaying) { if (IsRootChanged()) { InitTransforms(); SetupParticles(); } else { UpdateParameters(); } } } private bool IsRootChanged() { List<Transform> list = new List<Transform>(); if ((Object)(object)m_Root != (Object)null) { list.Add(m_Root); } if (m_Roots != null) { foreach (Transform root in m_Roots) { if ((Object)(object)root != (Object)null && !list.Contains(root)) { list.Add(root); } } } if (list.Count != m_ParticleTrees.Count) { return true; } for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)(object)m_ParticleTrees[i].m_Root) { return true; } } return false; } private void OnDidApplyAnimationProperties() { UpdateParameters(); } private void OnDrawGizmosSelected() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { if (Application.isEditor && !Application.isPlaying && ((Component)this).transform.hasChanged) { SetupParticles(); } Gizmos.color = Color.white; for (int i = 0; i < m_ParticleTrees.Count; i++) { DrawGizmos(m_ParticleTrees[i]); } } } private void DrawGizmos(ParticleTree pt) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_ParentIndex >= 0) { Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; Gizmos.DrawLine(particle.m_Position, particle2.m_Position); } if (particle.m_Radius > 0f) { Gizmos.DrawWireSphere(particle.m_Position, particle.m_Radius * m_ObjectScale); } } } public void SetWeight(float w) { if (m_Weight != w) { if (w == 0f) { InitTransforms(); } else if (m_Weight == 0f) { ResetParticlesPosition(); } m_Weight = (m_BlendWeight = w); } } public float GetWeight() { return m_Weight; } private void UpdateParticles() { if (m_ParticleTrees.Count <= 0) { return; } int num = 1; float timeVar = 1f; float deltaTime = m_DeltaTime; if (m_UpdateMode == UpdateMode.Default) { if (m_UpdateRate > 0f) { timeVar = deltaTime * m_UpdateRate; } } else if (m_UpdateRate > 0f) { float num2 = 1f / m_UpdateRate; m_Time += deltaTime; num = 0; while (m_Time >= num2) { m_Time -= num2; if (++num >= 3) { m_Time = 0f; break; } } } if (num > 0) { for (int i = 0; i < num; i++) { UpdateParticles1(timeVar, i); UpdateParticles2(timeVar); } } else { SkipUpdateParticles(); } } public void SetupParticles() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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) m_ParticleTrees.Clear(); if ((Object)(object)m_Root != (Object)null) { AppendParticleTree(m_Root); } if (m_Roots != null) { for (int i = 0; i < m_Roots.Count; i++) { Transform root = m_Roots[i]; if (!((Object)(object)root == (Object)null) && !m_ParticleTrees.Exists((ParticleTree x) => (Object)(object)x.m_Root == (Object)(object)root)) { AppendParticleTree(root); } } } m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ObjectPrevPosition = ((Component)this).transform.position; m_ObjectMove = Vector3.zero; for (int j = 0; j < m_ParticleTrees.Count; j++) { ParticleTree particleTree = m_ParticleTrees[j]; AppendParticles(particleTree, particleTree.m_Root, -1, 0f); } UpdateParameters(); } private void AppendParticleTree(Transform root) { //IL_0019: 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) if (!((Object)(object)root == (Object)null)) { ParticleTree particleTree = new ParticleTree(); particleTree.m_Root = root; particleTree.m_RootWorldToLocalMatrix = root.worldToLocalMatrix; m_ParticleTrees.Add(particleTree); } } private void AppendParticles(ParticleTree pt, Transform b, int parentIndex, float boneLength) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0039: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ab: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) Particle particle = new Particle(); particle.m_Transform = b; particle.m_TransformNotNull = (Object)(object)b != (Object)null; particle.m_ParentIndex = parentIndex; Vector3 val; if ((Object)(object)b != (Object)null) { val = (particle.m_Position = (particle.m_PrevPosition = b.position)); particle.m_InitLocalPosition = b.localPosition; particle.m_InitLocalRotation = b.localRotation; } else { Transform transform = pt.m_Particles[parentIndex].m_Transform; if (m_EndLength > 0f) { Transform parent = transform.parent; if ((Object)(object)parent != (Object)null) { particle.m_EndOffset = transform.InverseTransformPoint(transform.position * 2f - parent.position) * m_EndLength; } else { particle.m_EndOffset = new Vector3(m_EndLength, 0f, 0f); } } else { particle.m_EndOffset = transform.InverseTransformPoint(((Component)this).transform.TransformDirection(m_EndOffset) + transform.position); } val = (particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset))); particle.m_InitLocalPosition = Vector3.zero; particle.m_InitLocalRotation = Quaternion.identity; } if (parentIndex >= 0) { float num = boneLength; val = pt.m_Particles[parentIndex].m_Transform.position - particle.m_Position; boneLength = num + ((Vector3)(ref val)).magnitude; particle.m_BoneLength = boneLength; pt.m_BoneTotalLength = Mathf.Max(pt.m_BoneTotalLength, boneLength); pt.m_Particles[parentIndex].m_ChildCount++; } int count = pt.m_Particles.Count; pt.m_Particles.Add(particle); if (!((Object)(object)b != (Object)null)) { return; } for (int i = 0; i < b.childCount; i++) { Transform child = b.GetChild(i); bool flag = false; if (m_Exclusions != null) { flag = m_Exclusions.Contains(child); } if (!flag) { AppendParticles(pt, child, count, boneLength); } else if (m_EndLength > 0f || m_EndOffset != Vector3.zero) { AppendParticles(pt, null, count, boneLength); } } if (b.childCount == 0 && (m_EndLength > 0f || m_EndOffset != Vector3.zero)) { AppendParticles(pt, null, count, boneLength); } } public void UpdateParameters() { SetWeight(m_BlendWeight); for (int i = 0; i < m_ParticleTrees.Count; i++) { UpdateParameters(m_ParticleTrees[i]); } } private void UpdateParameters(ParticleTree pt) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) pt.m_RootWorldToLocalMatrix = pt.m_Root.worldToLocalMatrix; pt.m_LocalGravity = m_Gravity; for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; particle.m_Damping = m_Damping; particle.m_Elasticity = m_Elasticity; particle.m_Stiffness = m_Stiffness; particle.m_Inert = m_Inert; particle.m_Friction = m_Friction; particle.m_Radius = m_Radius; if (pt.m_BoneTotalLength > 0f) { float num = particle.m_BoneLength / pt.m_BoneTotalLength; if (m_DampingDistrib != null && ((Il2CppArrayBase<Keyframe>)(object)m_DampingDistrib.keys).Length > 0) { particle.m_Damping *= m_DampingDistrib.Evaluate(num); } if (m_ElasticityDistrib != null && ((Il2CppArrayBase<Keyframe>)(object)m_ElasticityDistrib.keys).Length > 0) { particle.m_Elasticity *= m_ElasticityDistrib.Evaluate(num); } if (m_StiffnessDistrib != null && ((Il2CppArrayBase<Keyframe>)(object)m_StiffnessDistrib.keys).Length > 0) { particle.m_Stiffness *= m_StiffnessDistrib.Evaluate(num); } if (m_InertDistrib != null && ((Il2CppArrayBase<Keyframe>)(object)m_InertDistrib.keys).Length > 0) { particle.m_Inert *= m_InertDistrib.Evaluate(num); } if (m_FrictionDistrib != null && ((Il2CppArrayBase<Keyframe>)(object)m_FrictionDistrib.keys).Length > 0) { particle.m_Friction *= m_FrictionDistrib.Evaluate(num); } if (m_RadiusDistrib != null && ((Il2CppArrayBase<Keyframe>)(object)m_RadiusDistrib.keys).Length > 0) { particle.m_Radius *= m_RadiusDistrib.Evaluate(num); } } particle.m_Damping = Mathf.Clamp01(particle.m_Damping); particle.m_Elasticity = Mathf.Clamp01(particle.m_Elasticity); particle.m_Stiffness = Mathf.Clamp01(particle.m_Stiffness); particle.m_Inert = Mathf.Clamp01(particle.m_Inert); particle.m_Friction = Mathf.Clamp01(particle.m_Friction); particle.m_Radius = Mathf.Max(particle.m_Radius, 0f); } } private void InitTransforms() { for (int i = 0; i < m_ParticleTrees.Count; i++) { InitTransforms(m_ParticleTrees[i]); } } private void InitTransforms(ParticleTree pt) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_TransformNotNull) { particle.m_Transform.localPosition = particle.m_InitLocalPosition; particle.m_Transform.localRotation = particle.m_InitLocalRotation; } } } private void ResetParticlesPosition() { //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) for (int i = 0; i < m_ParticleTrees.Count; i++) { ResetParticlesPosition(m_ParticleTrees[i]); } m_ObjectPrevPosition = ((Component)this).transform.position; } private void ResetParticlesPosition(ParticleTree pt) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_TransformNotNull) { particle.m_Position = (particle.m_PrevPosition = particle.m_Transform.position); } else { Transform transform = pt.m_Particles[particle.m_ParentIndex].m_Transform; particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset)); } particle.m_isCollide = false; } } private void UpdateParticles1(float timeVar, int loopIndex) { for (int i = 0; i < m_ParticleTrees.Count; i++) { UpdateParticles1(m_ParticleTrees[i], timeVar, loopIndex); } } private void UpdateParticles1(ParticleTree pt, float timeVar, int loopIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00d9: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) Vector3 val = m_Gravity; if (m_UseUnityModePhysics) { m_UnityModeMultiplier = 1.08f; } else { m_UnityModeMultiplier = 1f; } Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = normalized * Mathf.Max(Vector3.Dot(pt.m_RestGravity, normalized), 0f); val -= val2; val = (val + m_Force) * (m_ObjectScale * timeVar * m_UnityModeMultiplier); Vector3 val3 = ((loopIndex == 0) ? m_ObjectMove : Vector3.zero); for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_ParentIndex >= 0) { Vector3 val4 = particle.m_Position - particle.m_PrevPosition; Vector3 val5 = val3 * particle.m_Inert; particle.m_PrevPosition = particle.m_Position + val5; float num = particle.m_Damping; if (particle.m_isCollide) { num += particle.m_Friction; if (num > 1f) { num = 1f; } particle.m_isCollide = false; } particle.m_Position += val4 * (1f - num) + val + val5; } else { particle.m_PrevPosition = particle.m_Position; particle.m_Position = particle.m_TransformPosition; } } } private void UpdateParticles2(float timeVar) { for (int i = 0; i < m_ParticleTrees.Count; i++) { UpdateParticles2(m_ParticleTrees[i], timeVar); } } private void UpdateParticles2(ParticleTree pt, float timeVar) { //IL_0002: 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_00d7: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); float num = (m_UseUnityModePhysics ? 1.12f : 1f); float num2 = (m_UseUnityModePhysics ? 0.95f : 1f); int num3 = ((!m_IsPlayerBone || m_ConstraintIterations <= 1) ? 1 : Mathf.Min(m_ConstraintIterations, 2)); for (int i = 0; i < num3; i++) { float num4 = ((i == 0) ? 1f : (1f / (float)num3)); for (int j = 1; j < pt.m_Particles.Count; j++) { Particle particle = pt.m_Particles[j]; Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; Vector3 val2; float magnitude; if (particle.m_TransformNotNull) { val2 = particle2.m_TransformPosition - particle.m_TransformPosition; magnitude = ((Vector3)(ref val2)).magnitude; } else { val2 = ((Matrix4x4)(ref particle2.m_TransformLocalToWorldMatrix)).MultiplyVector(particle.m_EndOffset); magnitude = ((Vector3)(ref val2)).magnitude; } float num5 = Mathf.Lerp(1f, particle.m_Stiffness * num2, m_Weight); if (num5 > 0f || particle.m_Elasticity > 0f) { Matrix4x4 transformLocalToWorldMatrix = particle2.m_TransformLocalToWorldMatrix; ((Matrix4x4)(ref transformLocalToWorldMatrix)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val3 = ((!particle.m_TransformNotNull) ? ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_TransformLocalPosition)); Vector3 val4 = val3 - particle.m_Position; particle.m_Position += val4 * (particle.m_Elasticity * num * timeVar); if (num5 > 0f) { val4 = val3 - particle.m_Position; float magnitude2 = ((Vector3)(ref val4)).magnitude; float num6 = magnitude * (1f - num5) * 2f; if (magnitude2 > num6) { particle.m_Position += val4 * ((magnitude2 - num6) / magnitude2); } } } if (m_EffectiveColliders != null) { float particleRadius = particle.m_Radius * m_ObjectScale; for (int k = 0; k < m_EffectiveColliders.Count; k++) { DynamicBoneColliderBase dynamicBoneColliderBase = m_EffectiveColliders[k]; particle.m_isCollide |= dynamicBoneColliderBase.Collide(ref particle.m_Position, particleRadius); } } if (m_FreezeAxis != 0) { Vector4 column = ((Matrix4x4)(ref particle2.m_TransformLocalToWorldMatrix)).GetColumn((int)(m_FreezeAxis - 1)); Vector3 val5 = Vector4.op_Implicit(((Vector4)(ref column)).normalized); ((Plane)(ref val)).SetNormalAndPosition(val5, particle2.m_Position); particle.m_Position -= ((Plane)(ref val)).normal * ((Plane)(ref val)).GetDistanceToPoint(particle.m_Position); } Vector3 val6 = particle2.m_Position - particle.m_Position; float magnitude3 = ((Vector3)(ref val6)).magnitude; if (magnitude3 > 0f) { float num7 = (magnitude3 - magnitude) / magnitude3; if (m_IsPlayerBone && m_ConstraintSoftness > 0f) { float num8 = Mathf.Clamp01(m_ConstraintSoftness); num7 *= 1f - num8 * 0.65f; } num7 *= num4; particle.m_Position += val6 * num7; } } } } private void SkipUpdateParticles() { for (int i = 0; i < m_ParticleTrees.Count; i++) { SkipUpdateParticles(m_ParticleTrees[i]); } } private void SkipUpdateParticles(ParticleTree pt) { //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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0096: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_ParentIndex >= 0) { particle.m_PrevPosition += m_ObjectMove; particle.m_Position += m_ObjectMove; Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; Vector3 val; float magnitude; if (particle.m_TransformNotNull) { val = particle2.m_TransformPosition - particle.m_TransformPosition; magnitude = ((Vector3)(ref val)).magnitude; } else { val = ((Matrix4x4)(ref particle2.m_TransformLocalToWorldMatrix)).MultiplyVector(particle.m_EndOffset); magnitude = ((Vector3)(ref val)).magnitude; } float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight); if (num > 0f) { Matrix4x4 transformLocalToWorldMatrix = particle2.m_TransformLocalToWorldMatrix; ((Matrix4x4)(ref transformLocalToWorldMatrix)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val2 = ((!particle.m_TransformNotNull) ? ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_TransformLocalPosition)); Vector3 val3 = val2 - particle.m_Position; float magnitude2 = ((Vector3)(ref val3)).magnitude; float num2 = magnitude * (1f - num) * 2f; if (magnitude2 > num2) { particle.m_Position += val3 * ((magnitude2 - num2) / magnitude2); } } Vector3 val4 = particle2.m_Position - particle.m_Position; float magnitude3 = ((Vector3)(ref val4)).magnitude; if (magnitude3 > 0f) { particle.m_Position += val4 * ((magnitude3 - magnitude) / magnitude3); } } else { particle.m_PrevPosition = particle.m_Position; particle.m_Position = particle.m_TransformPosition; } } } private static Vector3 MirrorVector(Vector3 v, Vector3 axis) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return v - axis * (Vector3.Dot(v, axis) * 2f); } private static Vector3 ReflectPointAcrossPlane(Vector3 point, Vector3 planeNormal) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return point - 2f * Vector3.Dot(point, planeNormal) * planeNormal; } private Vector3 GetCatmullRomPosition(Vector3[] points, int bufferSize) { //IL_0012: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (points == null || bufferSize < 2) { if (points == null) { return Vector3.zero; } return points[0]; } Vector3 val = Vector3.zero; float num = 0f; for (int i = 0; i < bufferSize; i++) { float num2 = (float)(i + 1) / (float)bufferSize; val += points[i] * num2; num += num2; } if (num > 0f) { return val / num; } return points[bufferSize - 1]; } private void ApplyParticlesToTransforms() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a8: 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_00dd: 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_00df: Unknown result type (might be due to invalid IL or missing references) Vector3 right = Vector3.right; Vector3 up = Vector3.up; Vector3 forward = Vector3.forward; bool flag = false; bool flag2 = false; bool flag3 = false; Vector3 lossyScale = ((Component)this).transform.lossyScale; if (lossyScale.x < 0f || lossyScale.y < 0f || lossyScale.z < 0f) { Transform val = ((Component)this).transform; do { Vector3 localScale = val.localScale; flag = localScale.x < 0f; if (flag) { right = val.right; } flag2 = localScale.y < 0f; if (flag2) { up = val.up; } flag3 = localScale.z < 0f; if (flag3) { forward = val.forward; } if (flag || flag2 || flag3) { break; } val = val.parent; } while ((Object)(object)val != (Object)null); } for (int i = 0; i < m_ParticleTrees.Count; i++) { ApplyParticlesToTransforms(m_ParticleTrees[i], right, up, forward, flag, flag2, flag3); } } private void ApplyParticlesToTransforms(ParticleTree pt, Vector3 ax, Vector3 ay, Vector3 az, bool nx, bool ny, bool nz) { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: 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_00cd: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_037f: 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_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_02bb: Unknown result type (might be due to invalid IL or missing references) bool flag = m_EnableSmoothing && m_IsPlayerBone && m_SmoothingStrength > 0f; float num = Mathf.Clamp01(m_SmoothingStrength); for (int i = 1; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; if (particle2.m_ChildCount <= 1) { Vector3 val = ((!particle.m_TransformNotNull) ? particle.m_EndOffset : particle.m_Transform.localPosition); Vector3 val2 = particle2.m_Transform.TransformDirection(val); Vector3 val3 = particle.m_Position - particle2.m_Position; if (nx) { val3 = MirrorVector(val3, ax); } if (ny) { val3 = MirrorVector(val3, ay); } if (nz) { val3 = MirrorVector(val3, az); } Quaternion val4 = Quaternion.FromToRotation(val2, val3) * particle2.m_Transform.rotation; if (flag) { if (!particle2.m_SmoothingInitialized) { particle2.m_SmoothedRotation = particle2.m_Transform.rotation; particle2.m_SmoothingInitialized = true; } particle2.m_SmoothedRotation = Quaternion.Slerp(particle2.m_SmoothedRotation, val4, 1f - num); particle2.m_Transform.rotation = particle2.m_SmoothedRotation; } else { particle2.m_Transform.rotation = val4; } } if (!particle.m_TransformNotNull) { continue; } Vector3 position = particle.m_Position; if (flag) { if (m_UseTemporalSmoothing && !particle.m_HistoryInitialized) { particle.m_PositionHistory = (Vector3[])(object)new Vector3[m_TemporalBufferSize]; for (int j = 0; j < m_TemporalBufferSize; j++) { particle.m_PositionHistory[j] = particle.m_Transform.position; } particle.m_HistoryWriteIndex = 0; particle.m_HistoryInitialized = true; } if (!particle.m_SmoothingInitialized) { particle.m_SmoothedPosition = particle.m_Transform.position; particle.m_PrevFramePosition = particle.m_Transform.position; particle.m_SmoothingInitialized = true; } Vector3 val5 = position; if (m_UseTemporalSmoothing && particle.m_PositionHistory != null) { particle.m_HistoryWriteIndex = (particle.m_HistoryWriteIndex + 1) % m_TemporalBufferSize; particle.m_PositionHistory[particle.m_HistoryWriteIndex] = position; val5 = GetCatmullRomPosition(particle.m_PositionHistory, m_TemporalBufferSize); if (m_DebugLogging && Time.time - m_LastLogTime > 0.5f) { float value = Vector3.Distance(position, val5); MelonLogger.Msg($"[DynamicBone] Bone: {((Object)this).name}, Physics: {position}, Smoothed: {val5}, Delta: {value:F3}"); m_LastLogTime = Time.time; } } else { particle.m_Velocity = position - particle.m_PrevFramePosition; float magnitude = ((Vector3)(ref particle.m_Velocity)).magnitude; float num2 = num; if (m_UseAdaptiveSmoothing && magnitude > m_MaxPositionDelta) { float num3 = Mathf.Clamp01(magnitude / (m_MaxPositionDelta * 1.5f)); num2 = Mathf.Lerp(num, 0.05f, num3); } num2 = Mathf.Clamp(num2, 0.01f, 0.95f); val5 = Vector3.Lerp(particle.m_SmoothedPosition, position, 1f - num2); } particle.m_SmoothedPosition = val5; particle.m_Transform.position = val5; particle.m_PrevFramePosition = position; } else { particle.m_Transform.position = position; } } } } public class DynamicBoneCollider : DynamicBoneColliderBase { public float m_Radius = 0.5f; public float m_Height; private Vector3 m_ScaledCenter; private float m_ScaledRadius; private float m_C0; private float m_C1; private Vector3 m_C01Direction; public override void Prepare() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ScaledRadius = m_Radius * num; Vector3 scaledCenter = ((Component)this).transform.TransformPoint(m_Center); m_ScaledCenter = scaledCenter; float num2 = m_Height * num; if (m_Height > 0f) { Vector3 c01Direction = Vector3.up; switch (m_Direction) { case Direction.X: c01Direction = ((Component)this).transform.right; break; case Direction.Y: c01Direction = ((Component)this).transform.up; break; case Direction.Z: c01Direction = ((Component)this).transform.forward; break; } m_C0 = 0.5f * num2; m_C1 = 0f - m_C0; m_C01Direction = c01Direction; } else { m_C0 = (m_C1 = 0f); } } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0122: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) float num = m_ScaledRadius + particleRadius; if (m_Height <= 0f) { Vector3 val = particlePosition - m_ScaledCenter; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num * num) { float num2 = Mathf.Sqrt(sqrMagnitude); if (m_Bound == Bound.Outside) { particlePosition = m_ScaledCenter + val * (num / num2); } else { particlePosition = m_ScaledCenter + val * (m_ScaledRadius - particleRadius) / num2; } return true; } } else { Vector3 val2 = m_ScaledCenter + m_C01Direction * m_C0; Vector3 val3 = m_ScaledCenter + m_C01Direction * m_C1; Vector3 val4 = particlePosition; Vector3 val5 = val3 - val2; float num3 = Vector3.Dot(val4 - val2, val5) / ((Vector3)(ref val5)).sqrMagnitude; num3 = Mathf.Clamp01(num3); Vector3 val6 = val2 + val5 * num3; Vector3 val7 = val4 - val6; float sqrMagnitude2 = ((Vector3)(ref val7)).sqrMagnitude; if (sqrMagnitude2 > 0f && sqrMagnitude2 < num * num) { float num4 = Mathf.Sqrt(sqrMagnitude2); if (m_Bound == Bound.Outside) { particlePosition = val6 + val7 * (num / num4); } else { particlePosition = val6 + val7 * (m_ScaledRadius - particleRadius) / num4; } return true; } } return false; } } public class DynamicBoneColliderBase : MonoBehaviour { public enum Direction { X, Y, Z } public enum Bound { Outside, Inside } public Direction m_Direction = Direction.Y; public Vector3 m_Center = Vector3.zero; public Bound m_Bound; public int PrepareFrame = -1; public virtual void Prepare() { } public virtual bool Collide(ref Vector3 particlePosition, float particleRadius) { return false; } } public class DynamicBonePlaneCollider : DynamicBoneColliderBase { private Plane m_Plane; public override void Prepare() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.up; switch (m_Direction) { case Direction.X: val = ((Component)this).transform.right; break; case Direction.Y: val = ((Component)this).transform.up; break; case Direction.Z: val = ((Component)this).transform.forward; break; } Vector3 val2 = ((Component)this).transform.TransformPoint(m_Center); m_Plane = new Plane(val, val2); } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_0007: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) float distanceToPoint = ((Plane)(ref m_Plane)).GetDistanceToPoint(particlePosition); if (m_Bound == Bound.Outside) { if (distanceToPoint < particleRadius) { particlePosition -= ((Plane)(ref m_Plane)).normal * (distanceToPoint - particleRadius); return true; } } else if (distanceToPoint > 0f - particleRadius) { particlePosition -= ((Plane)(ref m_Plane)).normal * (distanceToPoint + particleRadius); return true; } return false; } } public class MapDbone : MonoBehaviour { public enum RigMode { Automatic, Hierarchy, PhantomRig } public enum UpdateMode { Normal, AnimatePhysics, UnscaledTime, Default } public enum ColliderGenerationMode { Manual, AutoCapsule, DynamicMesh } public enum FreezeAxis { None, X, Y, Z } private class Particle { public Transform m_Transform; public int m_ParentIndex; public int m_ChildCount; public float m_Damping; public float m_Elasticity; public float m_Stiffness; public float m_Inert; public float m_Friction; public float m_Radius; public float m_BoneLength; public bool m_isCollide; public bool m_TransformNotNull; public Vector3 m_Position; public Vector3 m_PrevPosition; public Vector3 m_EndOffset; public Vector3 m_InitLocalPosition; public Quaternion m_InitLocalRotation; public Vector3 m_TransformPosition; public Vector3 m_TransformLocalPosition; public Matrix4x4 m_TransformLocalToWorldMatrix; } private class ParticleTree { public Transform m_Root; public Vector3 m_LocalGravity; public Matrix4x4 m_RootWorldToLocalMatrix; public float m_BoneTotalLength; public List<Particle> m_Particles = new List<Particle>(); public Vector3 m_RestGravity; } public bool m_IsMapDynamicBone = true; public Transform m_Root; public RigMode m_RigMode; public List<Transform> m_ExcludeFromHierarchy; public int m_SegmentCount = 5; public Vector3 m_RigDirection = Vector3.up; public float m_RigLength; public bool m_AutoGenerateFromBounds = true; public float m_UpdateRate = 60f; public UpdateMode m_UpdateMode = UpdateMode.Default; public float m_Damping = 0.1f; public AnimationCurve m_DampingDistrib; public float m_Elasticity = 0.1f; public AnimationCurve m_ElasticityDistrib; public float m_Stiffness = 0.1f; public AnimationCurve m_StiffnessDistrib; public float m_Inert; public AnimationCurve m_InertDistrib; public float m_Friction; public AnimationCurve m_FrictionDistrib; public float m_Radius; public AnimationCurve m_RadiusDistrib; public Vector3 m_Gravity = Vector3.zero; public Vector3 m_Force = Vector3.zero; public float m_BlendWeight = 1f; public List<DynamicBoneColliderBase> m_Colliders; public ColliderGenerationMode m_ColliderMode; public bool m_CollideWithOtherChains; public bool m_CollideWithExternal = true; public float m_AutoCapsuleRadiusMultiplier = 1f; public bool m_GenerateCapsuleAlongChain = true; public int m_MeshUpdateInterval = 3; public int m_MeshSimplification = 1; public FreezeAxis m_FreezeAxis; public bool m_DistantDisable; public Transform m_ReferenceObject; public float m_DistanceToObject = 20f; public bool m_Multithread = true; private List<Transform> m_RigBones = new List<Transform>(); private GameObject m_PhantomRigRoot; private Bounds m_OriginalBounds; private bool m_UsingHierarchyMode; private List<DynamicBoneColliderBase> m_GeneratedColliders = new List<DynamicBoneColliderBase>(); private GameObject m_ColliderContainer; private int m_FrameCount; private Vector3 m_ObjectMove; private Vector3 m_ObjectPrevPosition; private float m_ObjectScale; private float m_Time; private float m_Weight = 1f; private bool m_DistantDisabled; private int m_PreUpdateCount; private List<ParticleTree> m_ParticleTrees = new List<ParticleTree>(); private float m_DeltaTime; private List<DynamicBoneColliderBase> m_EffectiveColliders; private static int s_UpdateCount; private static int s_PrepareFrame; private void Start() { if ((Object)(object)((Component)this).GetComponent<MapDboneMarker>() == (Object)null) { ((Component)this).gameObject.AddComponent<MapDboneMarker>(); } InitializeRig(); SetupParticles(); GenerateColliders(); } private void OnDestroy() { CleanupRig(); CleanupColliders(); } private void InitializeRig() { m_IsMapDynamicBone = true; if ((Object)(object)m_Root == (Object)null) { m_Root = ((Component)this).transform; } m_UsingHierarchyMode = false; m_RigBones.Clear(); RigMode rigMode = m_RigMode; if (rigMode == RigMode.Automatic) { rigMode = (HasValidHierarchy() ? RigMode.Hierarchy : RigMode.PhantomRig); } if (rigMode == RigMode.Hierarchy) { InitializeHierarchyMode(); } else { GeneratePhantomRig(); } MelonLogger.Msg($"MapDbone: Initialized in {(m_UsingHierarchyMode ? "Hierarchy" : "Phantom")} mode with {m_RigBones.Count} bones"); } private bool HasValidHierarchy() { if ((Object)(object)m_Root == (Object)null) { return false; } int num = 0; try { for (int i = 0; i < m_Root.childCount; i++) { Transform child = m_Root.GetChild(i); if ((Object)(object)child != (Object)null && !IsExcluded(child)) { num++; } } } catch (Exception ex) { MelonLogger.Msg("[MapDbone] Error checking hierarchy for " + ((Object)this).name + ": " + ex.Message); return false; } return num > 0; } private void InitializeHierarchyMode() { m_UsingHierarchyMode = true; m_RigBones.Clear(); CollectBonesFromHierarchy(m_Root); MelonLogger.Msg($"MapDbone: Using existing hierarchy with {m_RigBones.Count} bones"); } private void CollectBonesFromHierarchy(Transform parent, bool isRootCall = true) { if ((Object)(object)parent == (Object)null) { return; } if (!isRootCall) { m_RigBones.Add(parent); } try { for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if ((Object)(object)child != (Object)null && !IsExcluded(child)) {