Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PungusSouls v0.1.6
plugins/PungusSouls.dll
Decompiled 2 years 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.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CreatureManager; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocationManager; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using StatusEffectManager; using TMPro; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyProduct("PungusSouls")] [assembly: AssemblyCompany("Pungus")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("PungusSouls")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyFileVersion("0.0.7")] [assembly: AssemblyConfiguration("")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.7.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<f9ff7d5d-b4e5-47cf-9b56-603e70fb7d35>Embedded] internal sealed class <f9ff7d5d-b4e5-47cf-9b56-603e70fb7d35>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [<f9ff7d5d-b4e5-47cf-9b56-603e70fb7d35>Embedded] [CompilerGenerated] internal sealed class <4bc8397d-6ffa-4fe6-9846-4d3467239fd6>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <4bc8397d-6ffa-4fe6-9846-4d3467239fd6>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <4bc8397d-6ffa-4fe6-9846-4d3467239fd6>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] [<f9ff7d5d-b4e5-47cf-9b56-603e70fb7d35>Embedded] internal sealed class <ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContextAttribute : Attribute { public readonly byte Flag; public <ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContextAttribute(byte P_0) { Flag = P_0; } } } [AddComponentMenu("Dynamic Bone/Dynamic Bone")] [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(0)] [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(1)] public class DynamicBone : MonoBehaviour { [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(0)] public enum UpdateMode { Normal, AnimatePhysics, UnscaledTime, Default } [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(0)] public enum FreezeAxis { None, X, Y, Z } [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(0)] private class Particle { [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(1)] 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; } [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(0)] 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 Transform m_Root = null; public List<Transform> m_Roots = null; public float m_UpdateRate = 60f; public UpdateMode m_UpdateMode = UpdateMode.Default; [Range(0f, 1f)] public float m_Damping = 0.1f; public AnimationCurve m_DampingDistrib = null; [Range(0f, 1f)] public float m_Elasticity = 0.1f; public AnimationCurve m_ElasticityDistrib = null; [Range(0f, 1f)] public float m_Stiffness = 0.1f; public AnimationCurve m_StiffnessDistrib = null; [Range(0f, 1f)] public float m_Inert = 0f; public AnimationCurve m_InertDistrib = null; public float m_Friction = 0f; public AnimationCurve m_FrictionDistrib = null; public float m_Radius = 0f; public AnimationCurve m_RadiusDistrib = null; public float m_EndLength = 0f; public Vector3 m_EndOffset = Vector3.zero; public Vector3 m_Gravity = Vector3.zero; public Vector3 m_Force = Vector3.zero; [Range(0f, 1f)] public float m_BlendWeight = 1f; public List<DynamicBoneColliderBase> m_Colliders = null; public List<Transform> m_Exclusions = null; public FreezeAxis m_FreezeAxis = FreezeAxis.None; public bool m_DistantDisable = false; public Transform m_ReferenceObject = null; public float m_DistanceToObject = 20f; [HideInInspector] public bool m_Multithread = true; private Vector3 m_ObjectMove; private Vector3 m_ObjectPrevPosition; private float m_ObjectScale; private float m_Time = 0f; private float m_Weight = 1f; private bool m_DistantDisabled = false; private int m_PreUpdateCount = 0; private List<ParticleTree> m_ParticleTrees = new List<ParticleTree>(); private float m_DeltaTime; private List<DynamicBoneColliderBase> m_EffectiveColliders; private bool m_WorkAdded = false; private static List<DynamicBone> s_PendingWorks = new List<DynamicBone>(); private static List<DynamicBone> s_EffectiveWorks = new List<DynamicBone>(); private static AutoResetEvent s_AllWorksDoneEvent; private static int s_RemainWorkCount; private static Semaphore s_WorkQueueSemaphore; private static int s_WorkQueueIndex; private static int s_UpdateCount; private static int s_PrepareFrame; private void Start() { SetupParticles(); } private void FixedUpdate() { if (m_UpdateMode == UpdateMode.AnimatePhysics) { PreUpdate(); } } private void Update() { if (m_UpdateMode != UpdateMode.AnimatePhysics) { PreUpdate(); } if (m_PreUpdateCount > 0 && m_Multithread) { AddPendingWork(this); m_WorkAdded = true; } s_UpdateCount++; } private void LateUpdate() { if (m_PreUpdateCount == 0) { return; } if (s_UpdateCount > 0) { s_UpdateCount = 0; s_PrepareFrame++; } SetWeight(m_BlendWeight); if (m_WorkAdded) { m_WorkAdded = false; ExecuteWorks(); } else { CheckDistance(); if (IsNeedUpdate()) { Prepare(); UpdateParticles(); ApplyParticlesToTransforms(); } } m_PreUpdateCount = 0; } private void Prepare() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c8: 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) 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_Root.TransformDirection(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() { return m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled); } private void PreUpdate() { if (IsNeedUpdate()) { InitTransforms(); } m_PreUpdateCount++; } private void CheckDistance() { //IL_004f: 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_005f: 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) 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; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; bool flag = sqrMagnitude > m_DistanceToObject * m_DistanceToObject; if (flag != m_DistantDisabled) { if (!flag) { ResetParticlesPosition(); } m_DistantDisabled = flag; } } private void OnEnable() { ResetParticlesPosition(); } private void OnDisable() { InitTransforms(); } 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); 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_0039: 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_0037: 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_005e: 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_00b8: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) 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_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_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_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0104: 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_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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_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_00c1: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Matrix4x4)(ref pt.m_RootWorldToLocalMatrix)).MultiplyVector(m_Gravity); pt.m_LocalGravity = ((Vector3)(ref val)).normalized * ((Vector3)(ref m_Gravity)).magnitude; 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 && m_DampingDistrib.keys.Length != 0) { particle.m_Damping *= m_DampingDistrib.Evaluate(num); } if (m_ElasticityDistrib != null && m_ElasticityDistrib.keys.Length != 0) { particle.m_Elasticity *= m_ElasticityDistrib.Evaluate(num); } if (m_StiffnessDistrib != null && m_StiffnessDistrib.keys.Length != 0) { particle.m_Stiffness *= m_StiffnessDistrib.Evaluate(num); } if (m_InertDistrib != null && m_InertDistrib.keys.Length != 0) { particle.m_Inert *= m_InertDistrib.Evaluate(num); } if (m_FrictionDistrib != null && m_FrictionDistrib.keys.Length != 0) { particle.m_Friction *= m_FrictionDistrib.Evaluate(num); } if (m_RadiusDistrib != null && 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_0025: 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) 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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) 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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_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_0039: 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_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_005e: 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_0063: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_009c: 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_00a8: 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) //IL_00c2: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) Vector3 gravity = m_Gravity; Vector3 normalized = ((Vector3)(ref m_Gravity)).normalized; Vector3 val = normalized * Mathf.Max(Vector3.Dot(pt.m_RestGravity, normalized), 0f); gravity -= val; gravity = (gravity + m_Force) * (m_ObjectScale * timeVar); Vector3 val2 = ((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 val3 = particle.m_Position - particle.m_PrevPosition; Vector3 val4 = val2 * particle.m_Inert; particle.m_PrevPosition = particle.m_Position + val4; 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 += val3 * (1f - num) + gravity + val4; } 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_0003: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c1: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0240: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: 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_0104: 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_010e: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_0193: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); for (int i = 1; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; 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 num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight); if (num > 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 * timeVar); if (num > 0f) { val4 = val3 - particle.m_Position; float magnitude2 = ((Vector3)(ref val4)).magnitude; float num2 = magnitude * (1f - num) * 2f; if (magnitude2 > num2) { particle.m_Position += val4 * ((magnitude2 - num2) / magnitude2); } } } if (m_EffectiveColliders != null) { float particleRadius = particle.m_Radius * m_ObjectScale; for (int j = 0; j < m_EffectiveColliders.Count; j++) { DynamicBoneColliderBase dynamicBoneColliderBase = m_EffectiveColliders[j]; 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) { particle.m_Position += val6 * ((magnitude3 - magnitude) / magnitude3); } } } private void SkipUpdateParticles() { for (int i = 0; i < m_ParticleTrees.Count; i++) { SkipUpdateParticles(m_ParticleTrees[i]); } } private void SkipUpdateParticles(ParticleTree pt) { //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_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_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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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) 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_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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) return v - axis * (Vector3.Dot(v, axis) * 2f); } private void ApplyParticlesToTransforms() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0028: 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_0044: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0110: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_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) 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_00fa: 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_004f: 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_0069: 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_0070: 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_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_0083: 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_008f: 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_009f: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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) 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 = val4 * particle2.m_Transform.rotation; } if (particle.m_TransformNotNull) { particle.m_Transform.position = particle.m_Position; } } } private static void AddPendingWork(DynamicBone db) { s_PendingWorks.Add(db); } private static void AddWorkToQueue(DynamicBone db) { s_WorkQueueSemaphore.Release(); } private static DynamicBone GetWorkFromQueue() { int index = Interlocked.Increment(ref s_WorkQueueIndex); return s_EffectiveWorks[index]; } private static void ThreadProc() { while (true) { s_WorkQueueSemaphore.WaitOne(); DynamicBone workFromQueue = GetWorkFromQueue(); workFromQueue.UpdateParticles(); if (Interlocked.Decrement(ref s_RemainWorkCount) <= 0) { s_AllWorksDoneEvent.Set(); } } } private static void InitThreadPool() { s_AllWorksDoneEvent = new AutoResetEvent(initialState: false); s_WorkQueueSemaphore = new Semaphore(0, int.MaxValue); int processorCount = Environment.ProcessorCount; for (int i = 0; i < processorCount; i++) { Thread thread = new Thread(ThreadProc); thread.IsBackground = true; thread.Start(); } } private static void ExecuteWorks() { if (s_PendingWorks.Count <= 0) { return; } s_EffectiveWorks.Clear(); for (int i = 0; i < s_PendingWorks.Count; i++) { DynamicBone dynamicBone = s_PendingWorks[i]; if ((Object)(object)dynamicBone != (Object)null && ((Behaviour)dynamicBone).enabled) { dynamicBone.CheckDistance(); if (dynamicBone.IsNeedUpdate()) { s_EffectiveWorks.Add(dynamicBone); } } } s_PendingWorks.Clear(); if (s_EffectiveWorks.Count > 0) { if (s_AllWorksDoneEvent == null) { InitThreadPool(); } int num = (s_RemainWorkCount = s_EffectiveWorks.Count); s_WorkQueueIndex = -1; for (int j = 0; j < num; j++) { DynamicBone dynamicBone2 = s_EffectiveWorks[j]; dynamicBone2.Prepare(); AddWorkToQueue(dynamicBone2); } s_AllWorksDoneEvent.WaitOne(); for (int k = 0; k < num; k++) { DynamicBone dynamicBone3 = s_EffectiveWorks[k]; dynamicBone3.ApplyParticlesToTransforms(); } } } } [AddComponentMenu("Dynamic Bone/Dynamic Bone Collider")] public class DynamicBoneCollider : DynamicBoneColliderBase { public float m_Radius = 0.5f; public float m_Height = 0f; public float m_Radius2 = 0f; private float m_ScaledRadius; private float m_ScaledRadius2; private Vector3 m_C0; private Vector3 m_C1; private float m_C01Distance; private int m_CollideType; private void OnValidate() { m_Radius = Mathf.Max(m_Radius, 0f); m_Height = Mathf.Max(m_Height, 0f); m_Radius2 = Mathf.Max(m_Radius2, 0f); } public override void Prepare() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(((Component)this).transform.lossyScale.x); float num2 = m_Height * 0.5f; Vector3 val; if (m_Radius2 <= 0f || Mathf.Abs(m_Radius - m_Radius2) < 0.01f) { m_ScaledRadius = m_Radius * num; float num3 = num2 - m_Radius; if (num3 <= 0f) { m_C0 = ((Component)this).transform.TransformPoint(m_Center); if (m_Bound == Bound.Outside) { m_CollideType = 0; } else { m_CollideType = 1; } return; } Vector3 center = m_Center; Vector3 center2 = m_Center; switch (m_Direction) { case Direction.X: center.x += num3; center2.x -= num3; break; case Direction.Y: center.y += num3; center2.y -= num3; break; case Direction.Z: center.z += num3; center2.z -= num3; break; } m_C0 = ((Component)this).transform.TransformPoint(center); m_C1 = ((Component)this).transform.TransformPoint(center2); val = m_C1 - m_C0; m_C01Distance = ((Vector3)(ref val)).magnitude; if (m_Bound == Bound.Outside) { m_CollideType = 2; } else { m_CollideType = 3; } return; } float num4 = Mathf.Max(m_Radius, m_Radius2); if (num2 - num4 <= 0f) { m_ScaledRadius = num4 * num; m_C0 = ((Component)this).transform.TransformPoint(m_Center); if (m_Bound == Bound.Outside) { m_CollideType = 0; } else { m_CollideType = 1; } return; } m_ScaledRadius = m_Radius * num; m_ScaledRadius2 = m_Radius2 * num; float num5 = num2 - m_Radius; float num6 = num2 - m_Radius2; Vector3 center3 = m_Center; Vector3 center4 = m_Center; switch (m_Direction) { case Direction.X: center3.x += num5; center4.x -= num6; break; case Direction.Y: center3.y += num5; center4.y -= num6; break; case Direction.Z: center3.z += num5; center4.z -= num6; break; } m_C0 = ((Component)this).transform.TransformPoint(center3); m_C1 = ((Component)this).transform.TransformPoint(center4); val = m_C1 - m_C0; m_C01Distance = ((Vector3)(ref val)).magnitude; if (m_Bound == Bound.Outside) { m_CollideType = 4; } else { m_CollideType = 5; } } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_0030: 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_0062: 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_0084: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_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) return m_CollideType switch { 0 => OutsideSphere(ref particlePosition, particleRadius, m_C0, m_ScaledRadius), 1 => InsideSphere(ref particlePosition, particleRadius, m_C0, m_ScaledRadius), 2 => OutsideCapsule(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_C01Distance), 3 => InsideCapsule(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_C01Distance), 4 => OutsideCapsule2(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_ScaledRadius2, m_C01Distance), 5 => InsideCapsule2(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_ScaledRadius2, m_C01Distance), _ => false, }; } private static bool OutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: Unknown result type (might be due to invalid IL or missing references) float num = sphereRadius + particleRadius; float num2 = num * num; Vector3 val = particlePosition - sphereCenter; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num2) { float num3 = Mathf.Sqrt(sqrMagnitude); particlePosition = sphereCenter + val * (num / num3); return true; } return false; } private static bool InsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_0042: Unknown result type (might be due to invalid IL or missing references) float num = sphereRadius - particleRadius; float num2 = num * num; Vector3 val = particlePosition - sphereCenter; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > num2) { float num3 = Mathf.Sqrt(sqrMagnitude); particlePosition = sphereCenter + val * (num / num3); return true; } return false; } private static bool OutsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen) { //IL_000a: 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_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) //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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e9: Unknown result type (might be due to invalid IL or missing references) float num = capsuleRadius + particleRadius; float num2 = num * num; Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num3 = Vector3.Dot(val2, val); if (num3 <= 0f) { float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num2) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num / num4); return true; } } else { float num5 = dirlen * dirlen; if (num3 >= num5) { val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > 0f && sqrMagnitude2 < num2) { float num6 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num / num6); return true; } } else { Vector3 val3 = val2 - val * (num3 / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude3 > 0f && sqrMagnitude3 < num2) { float num7 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num - num7) / num7); return true; } } } return false; } private static bool InsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen) { //IL_000a: 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_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) //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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_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_009c: 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_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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_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_00d1: Unknown result type (might be due to invalid IL or missing references) float num = capsuleRadius - particleRadius; float num2 = num * num; Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num3 = Vector3.Dot(val2, val); if (num3 <= 0f) { float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > num2) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num / num4); return true; } } else { float num5 = dirlen * dirlen; if (num3 >= num5) { val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > num2) { float num6 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num / num6); return true; } } else { Vector3 val3 = val2 - val * (num3 / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude3 > num2) { float num7 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num - num7) / num7); return true; } } } return false; } private static bool OutsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_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_0067: 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_006e: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num = Vector3.Dot(val2, val); if (num <= 0f) { float num2 = capsuleRadius0 + particleRadius; float num3 = num2 * num2; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num3) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num2 / num4); return true; } } else { float num5 = dirlen * dirlen; if (num >= num5) { float num6 = capsuleRadius1 + particleRadius; float num7 = num6 * num6; val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > 0f && sqrMagnitude2 < num7) { float num8 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num6 / num8); return true; } } else { Vector3 val3 = val2 - val * (num / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; float num9 = Vector3.Dot(val2, val / dirlen); float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) + particleRadius; float num11 = num10 * num10; if (sqrMagnitude3 > 0f && sqrMagnitude3 < num11) { float num12 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num10 - num12) / num12); return true; } } } return false; } private static bool InsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num = Vector3.Dot(val2, val); if (num <= 0f) { float num2 = capsuleRadius0 - particleRadius; float num3 = num2 * num2; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > num3) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num2 / num4); return true; } } else { float num5 = dirlen * dirlen; if (num >= num5) { float num6 = capsuleRadius1 - particleRadius; float num7 = num6 * num6; val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > num7) { float num8 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num6 / num8); return true; } } else { Vector3 val3 = val2 - val * (num / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; float num9 = Vector3.Dot(val2, val / dirlen); float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) - particleRadius; float num11 = num10 * num10; if (sqrMagnitude3 > num11) { float num12 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num10 - num12) / num12); return true; } } } return false; } private void OnDrawGizmosSelected() { //IL_0037: 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_006d: 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_0087: 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_00a7: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { Prepare(); if (m_Bound == Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } switch (m_CollideType) { case 0: case 1: Gizmos.DrawWireSphere(m_C0, m_ScaledRadius); break; case 2: case 3: DrawCapsule(m_C0, m_C1, m_ScaledRadius, m_ScaledRadius); break; case 4: case 5: DrawCapsule(m_C0, m_C1, m_ScaledRadius, m_ScaledRadius2); break; } } } private static void DrawCapsule(Vector3 c0, Vector3 c1, float radius0, float radius1) { //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_0009: 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) Gizmos.DrawLine(c0, c1); Gizmos.DrawWireSphere(c0, radius0); Gizmos.DrawWireSphere(c1, radius1); } } 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 = Bound.Outside; public int PrepareFrame { get; set; } public virtual void Start() { } public virtual void Prepare() { } public virtual bool Collide(ref Vector3 particlePosition, float particleRadius) { return false; } } [AddComponentMenu("Dynamic Bone/Dynamic Bone Plane Collider")] public class DynamicBonePlaneCollider : DynamicBoneColliderBase { private Plane m_Plane; private void OnValidate() { } public override void Prepare() { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) 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); ((Plane)(ref m_Plane)).SetNormalAndPosition(val, val2); } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_0008: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) float distanceToPoint = ((Plane)(ref m_Plane)).GetDistanceToPoint(particlePosition); if (m_Bound == Bound.Outside) { if (distanceToPoint < 0f) { particlePosition -= ((Plane)(ref m_Plane)).normal * distanceToPoint; return true; } } else if (distanceToPoint > 0f) { particlePosition -= ((Plane)(ref m_Plane)).normal * distanceToPoint; return true; } return false; } private void OnDrawGizmosSelected() { //IL_0034: 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_0047: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { Prepare(); if (m_Bound == Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } Vector3 val = ((Component)this).transform.TransformPoint(m_Center); Gizmos.DrawLine(val, val + ((Plane)(ref m_Plane)).normal); } } } namespace StatusEffectManager { [PublicAPI] [Description("The ItemDrop effect to apply the status effect")] public enum EffectType { Equip, Attack, Consume, Set } public struct SE_Item { [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(1)] public StatusEffect Effect; public EffectType Type; } [PublicAPI] [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(1)] [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(0)] public class CustomSE { private static readonly List<CustomSE> RegisteredEffects = new List<CustomSE>(); private static readonly Dictionary<StatusEffect, CustomSE> CustomEffectMap = new Dictionary<StatusEffect, CustomSE>(); internal static readonly List<StatusEffect> CustomSEs = new List<StatusEffect>(); internal static readonly Dictionary<SE_Item, string> AddToPrefabs = new Dictionary<SE_Item, string>(); [Description("Instance of the StatusEffect.")] public readonly StatusEffect Effect; public EffectType Type; private string _folderName = "icons"; private AssetBundle _assetBundle = null; [Description("Sets the icon for the StatusEffect. Must be 64x64")] [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] public Sprite IconSprite = null; [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private string IconName = null; [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private LocalizeKey _name; [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private static Localization _english; [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private static BaseUnityPlugin _plugin; private static bool hasConfigSync = true; [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private static object _configSync; [Description("Sets the icon for the StatusEffect. Must be 64x64")] [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] public string Icon { [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(2)] get { return IconName; } [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(2)] set { IconName = value; IconSprite = ((IconName == null) ? null : loadSprite(IconName)); Effect.m_icon = IconSprite; } } [Description("Sets the in-game name for the StatusEffect")] public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } StatusEffect effect = Effect; if (effect.m_name.StartsWith("$")) { _name = new LocalizeKey(effect.m_name); } else { string text = "$statuseffect_" + ((Object)Effect).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(effect.m_name); effect.m_name = text; } return _name; } } private static Localization english { get { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (_english == null) { _english = new Localization(); _english.SetupLanguage("English"); } return _english; } } private static BaseUnityPlugin plugin { get { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private static object configSync { [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(2)] get { if (_configSync == null && hasConfigSync) { Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " ItemManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } } return _configSync; } } public CustomSE(string assetBundleFileName, string customEffectName, string folderName = "assets") : this(EffectManager.RegisterAssetBundle(assetBundleFileName, folderName), customEffectName) { } public CustomSE(AssetBundle bundle, string customEffectName) { Effect = EffectManager.RegisterCustomSE(bundle, customEffectName); RegisteredEffects.Add(this); CustomEffectMap[Effect] = this; } public CustomSE(string customEffectName) { Effect = ScriptableObject.CreateInstance<StatusEffect>(); EffectManager.RegisterCustomSE(Effect, customEffectName); RegisteredEffects.Add(this); CustomEffectMap[Effect] = this; } [return: <4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private byte[] ReadEmbeddedFileBytes(string name) { using MemoryStream memoryStream = new MemoryStream(); Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + ((_folderName == "") ? "" : ".") + _folderName + "." + name); if (manifestResourceStream == null) { return null; } manifestResourceStream.CopyTo(memoryStream); return memoryStream.ToArray(); } [return: <4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] private Texture2D loadTexture(string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown byte[] array = ReadEmbeddedFileBytes(name); if (array != null) { Texture2D val = new Texture2D(0, 0); ImageConversion.LoadImage(val, array); return val; } return null; } private Sprite loadSprite(string name) { //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) Texture2D val = loadTexture(name); if (val != null) { return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), Vector2.zero); } AssetBundle assetBundle = _assetBundle; Sprite val2 = ((assetBundle != null) ? assetBundle.LoadAsset<Sprite>(name) : null); if (val2 != null) { return val2; } throw new FileNotFoundException("Could not find a file named " + name + " for the effect icon"); } public void AddSEToPrefab(CustomSE customSE, string prefabName) { SE_Item sE_Item = default(SE_Item); sE_Item.Effect = customSE.Effect; sE_Item.Type = customSE.Type; SE_Item key = sE_Item; AddToPrefabs.Add(key, prefabName); } private static ConfigEntry<T> config<[<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] T>(string group, string name, T value, ConfigDescription description) { ConfigEntry<T> val = plugin.Config.Bind<T>(group, name, value, description); configSync?.GetType().GetMethod("AddConfigEntry").MakeGenericMethod(typeof(T)) .Invoke(configSync, new object[1] { val }); return val; } private static ConfigEntry<T> config<[<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(2)] T>(string group, string name, T value, string description) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } } [PublicAPI] [<ff97f7d9-7f48-44a2-a23f-4f039e0cea12>NullableContext(1)] [<4bc8397d-6ffa-4fe6-9846-4d3467239fd6>Nullable(0)] public class LocalizeKey { public readonly string Key; public LocalizeKey(string key) { Key = key.Replace("$", ""); } public LocalizeKey English(string key) { return addForLang("English", key); } public LocalizeKey Swedish(string key) { return addForLang("Swedish", key); } public LocalizeKey French(string key) { return addForLang("French", key); } public LocalizeKey Italian(string key) { return addForLang("Italian", key); } public LocalizeKey German(string key) { return addForLang("German", key); } public LocalizeKey Spanish(string key) { return addForLang("Spanish", key); } public LocalizeKey Russian(string key) { return addForLang("Russian", key); } public LocalizeKey Romanian(string key) { return addForLang("Romanian", key); } public LocalizeKey Bulgarian(string key) { return addForLang("Bulgarian", key); } public LocalizeKey Macedonian(string key) { return addForLang("Macedonian", key); } public LocalizeKey Finnish(string key) { return addForLang("Finnish", key); } public LocalizeKey Danish(string key) { return addForLang("Danish", key); } public LocalizeKey Norwegian(string key) { return addForLang("Norwegian", key); } public LocalizeKey Icelandic(string key) { return addForLang("Icelandic", key); } public LocalizeKey Turkish(string key) { return addForLang("Turkish", key); } public LocalizeKey Lithuanian(string key) { return addForLang("Lithuanian", key); } public LocalizeKey Czech(string key) { return addForLang("Czech", key); } public LocalizeKey Hungarian(string key) { return addForLang("Hungarian", key); } public LocalizeKey Slovak(string key) { return addForLang("Slovak", key); } public LocalizeKey Polish(string key) { return addForLang("Polish", key); } public LocalizeKey Dutch(string key) { return addForLang("Dutch", key); } public LocalizeKey Portuguese_European(string key) { return addForLang("Portuguese_European", key); } public LocalizeKey Portuguese_Brazilian(string key) { return addForLang("Portuguese_Brazilian", key); } public LocalizeKey Chinese(string key) { return addForLang("Chinese", key); } public LocalizeKey Japanese(string key) { return addForLang("Japanese", key); } public LocalizeKey Korean(string key) { return addForLang("Korean", key); } public LocalizeKey Hindi(string key) { return addForLang("Hindi", key); } public LocalizeKey Thai(string key) { return addForLang("Thai", key); } public LocalizeKey Abenaki(string key) { return addForLang("Abenaki", key); } public LocalizeKey Croatian(string key) { return addForLang("Croatian", key); } public LocalizeKey Georgian(string key) { return addForLang("Georgian", key); } public LocalizeKey Greek(string key) { return addForLang("Greek", key); } public LocalizeKey Serbian(string key) { return addForLang("Serbian", key); } public LocalizeKey Ukrainian(string key) { return addForLang("Ukrainian", key); } private LocalizeKey addForLang(string lang, string value) { if (Localization.instance.GetSelectedLanguage() == lang)