Decompiled source of Chirpling v3.1.2
Taskyy.Chirpling.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Chirpling.Network; using Chirpling.Patch; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using MoreCompany.Utils; using Taskyy.Chirpling.NetcodePatcher; using Unity.Netcode; using Unity.Netcode.Samples; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Taskyy.Chirpling")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d5948c3fdc582d873f1217d197203eb77088af22")] [assembly: AssemblyProduct("Chirpling")] [assembly: AssemblyTitle("Taskyy.Chirpling")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [AddComponentMenu("Dynamic Bone/Dynamic Bone")] public class DynamicBone : MonoBehaviour { public enum UpdateMode { Normal, AnimatePhysics, UnscaledTime, Default } public enum FreezeAxis { None, X, Y, Z } private class Particle { public Transform m_Transform; public int m_ParentIndex; public int m_ChildCount; public float m_Damping; public float m_Elasticity; public float m_Stiffness; public float m_Inert; public float m_Friction; public float m_Radius; public float m_BoneLength; public bool m_isCollide; public bool m_TransformNotNull; public Vector3 m_Position; public Vector3 m_PrevPosition; public Vector3 m_EndOffset; public Vector3 m_InitLocalPosition; public Quaternion m_InitLocalRotation; public Vector3 m_TransformPosition; public Vector3 m_TransformLocalPosition; public Matrix4x4 m_TransformLocalToWorldMatrix; } 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 Chirpling { internal class AssetLoader { public class ChirplingData { public string name; public Color? color; public int materialIndex; public ChirplingData(string name, Color? color, int materialIndex) { this.name = name; this.color = color; this.materialIndex = materialIndex; } } private static List<ChirplingData> chirplingList; private static AssetBundle mainBundle; private static AssetBundle cosmeticBundle; public static AssetBundle GetMainBundle() { return mainBundle; } public static GameObject LoadPrefab(string str, string assetPath = "Assets/Taskyy/Prefab/") { return mainBundle.LoadAsset<GameObject>(assetPath + str + ".prefab"); } public static void Load() { mainBundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Plugin).Namespace.Split(".")[0] + ".Resources.assets_chirplingmod")); cosmeticBundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Plugin).Namespace.Split(".")[0] + ".Resources.cosmetics_chirplingmod")); chirplingList = LoadChirplingCSV(); if (chirplingList != null && chirplingList.Count > 0) { PluginLogger.Log("Loaded " + chirplingList.Count + " names of Chirplings!"); } else { PluginLogger.LogError("Something went wrong when reading the CSV with Chirpling names!"); } RegisterCosmetic("tealthecockatielshoulder", "TealCosmeticShoulder", "TealIcon_LS", (CosmeticType)2); RegisterCosmetic("tealthecockatielhead", "TealCosmeticHead", "TealIcon_H", (CosmeticType)0); RegisterCosmetic("chirpling", "ChirplingCosmeticRight", "ChirplingIcon_RS", (CosmeticType)2); RegisterScrap(mainBundle, "ThrowableChirpling"); RegisterScrap(mainBundle, "GroanTubeChirpling"); RegisterScrap(mainBundle, "BombChirpling", 15, "Assets/Taskyy/Scrap/ScriptableObject/", adjustSpawns: false); RegisterScrap(mainBundle, "BigChirpling", 18); RegisterScrap(mainBundle, "Teal", 15); TerminalKeyword terminalKeyword = RegisterTerminalNode(mainBundle, "ChirplingBeastiary", "chirpling"); RegisterEnemy(mainBundle, "EnemyChirpling", terminalKeyword, 55); } public static TerminalKeyword RegisterTerminalNode(AssetBundle bundle, string str, string keyword, string assetPath = "Assets/Taskyy/TerminalNode/ScriptableObject/") { TerminalNode val = bundle.LoadAsset<TerminalNode>(assetPath + str + ".asset"); return TerminalUtils.CreateTerminalKeyword(keyword, true, (CompatibleNoun[])null, val, (TerminalKeyword)null, false); } public static void RegisterEnemy(AssetBundle bundle, string str, TerminalKeyword terminalKeyword, int rarity = 1000, string assetPath = "Assets/Taskyy/Enemy/ScriptableObject/") { EnemyType val = bundle.LoadAsset<EnemyType>(assetPath + str + ".asset"); EnemyAI component = val.enemyPrefab.GetComponent<EnemyAI>(); component.enemyType = val; NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, rarity, (LevelTypes)(-1), (SpawnType)0, terminalKeyword.specialKeywordResult, terminalKeyword); } public static void RegisterScrap(AssetBundle bundle, string str, int rarity = 25, string assetPath = "Assets/Taskyy/Scrap/ScriptableObject/", bool adjustSpawns = true) { //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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Invalid comparison between Unknown and I4 //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_00c3: Invalid comparison between Unknown and I4 //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Invalid comparison between Unknown and I4 //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 //IL_00dd: 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_00ff: Invalid comparison between Unknown and I4 //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Invalid comparison between Unknown and I4 //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Invalid comparison between Unknown and I4 //IL_012b: Unknown result type (might be due to invalid IL or missing references) Item val = bundle.LoadAsset<Item>(assetPath + str + ".asset"); GrabbableObject component = val.spawnPrefab.GetComponent<GrabbableObject>(); component.grabbable = true; component.grabbableToEnemies = true; component.isInFactory = true; component.itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); if (adjustSpawns) { foreach (LevelTypes value in Enum.GetValues(typeof(LevelTypes))) { if ((int)value >= 4 && (int)value <= 16) { Items.RegisterScrap(val, Mathf.RoundToInt((float)rarity), value); } if (((int)value >= 32 && (int)value <= 64) || (int)value == 2048) { Items.RegisterScrap(val, Mathf.RoundToInt((float)rarity * 1.2f), value); } if (((int)value >= 128 && (int)value <= 512) || ((int)value >= 4096 && (int)value <= 8192) || (int)value == 1024) { Items.RegisterScrap(val, Mathf.RoundToInt((float)rarity * 1.4f), value); } } } Items.RegisterScrap(val, Mathf.RoundToInt((float)rarity), (LevelTypes)(-1)); } private static List<ChirplingData> LoadChirplingCSV() { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) List<ChirplingData> list = new List<ChirplingData>(); string name = typeof(AssetLoader).Namespace + ".Resources.custom_chirplings_data.csv"; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) { if (stream == null) { PluginLogger.LogError("Error trying to load Chirpling CSV!"); return null; } using StreamReader streamReader = new StreamReader(stream); string text; Color value = default(Color); while ((text = streamReader.ReadLine()) != null) { string[] array = text.Split(','); if (array.Length != 3) { PluginLogger.LogError("Chirplings CSV length != 3, SKIPPING! line: " + text); continue; } string name2 = array[0]; string text2 = array[1].Trim(); Color? color = null; if (!string.IsNullOrEmpty(text2)) { if (!ColorUtility.TryParseHtmlString(text2, ref value)) { PluginLogger.LogError("Chirplings CSV failed to parse color code, SKIPPING! line: " + text); continue; } color = value; } int materialIndex = 0; if (!array[2].Equals("")) { if (!int.TryParse(array[2], out var result)) { PluginLogger.LogError("Chirplings CSV failed to parse material index, SKIPPING! line: " + text); continue; } materialIndex = result; } list.Add(new ChirplingData(name2, color, materialIndex)); } } return list; } public static List<ChirplingData> GetChirplingList() { if (chirplingList != null) { return chirplingList; } return new List<ChirplingData>(); } public static void RegisterCosmetic(string cosmeticId, string gameObjectPath, string textureIconPath, CosmeticType cosmeticType) { //IL_007d: 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) GameObject val = AssetBundleExtension.LoadPersistentAsset<GameObject>(cosmeticBundle, gameObjectPath); if ((Object)(object)val == (Object)null) { PluginLogger.LogError("Failed to load GameObject for \"" + cosmeticId + "\" at path: " + gameObjectPath); return; } Texture2D val2 = AssetBundleExtension.LoadPersistentAsset<Texture2D>(cosmeticBundle, textureIconPath); if ((Object)(object)val2 == (Object)null) { PluginLogger.LogError("Failed to load Sprite for \"" + cosmeticId + "\" at path: " + textureIconPath); return; } CosmeticInstance val3 = val.AddComponent<CosmeticInstance>(); val3.cosmeticId = cosmeticId; val3.icon = val2; val3.cosmeticType = cosmeticType; CosmeticRegistry.cosmeticInstances.Add(cosmeticId, val3); } } internal class Config { public static ConfigEntry<bool> enablePhysics; public static ConfigEntry<bool> muteTeal; public static void BindConfig(BaseUnityPlugin plugin) { enablePhysics = plugin.Config.Bind<bool>("Client Side", "PhysicsEnabled", true, "Enable or disable physics bones, set to false to disable physics bones everywhere."); muteTeal = plugin.Config.Bind<bool>("Client Side", "MuteTeal", false, "Mutes the Teal cosmetic's random whistling"); } } internal class DeathMessages { } [BepInPlugin("Taskyy.Chirpling", "Chirpling Scrap Item", "3.1.2")] public class Plugin : BaseUnityPlugin { public const string modID = "Taskyy.Chirpling"; public const string modName = "Chirpling Scrap Item"; public const string version = "3.1.2"; private readonly Harmony harmony = new Harmony("Taskyy.Chirpling"); private static Plugin Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PluginLogger.Load(); AssetLoader.Load(); Config.BindConfig((BaseUnityPlugin)(object)this); harmony.PatchAll(typeof(GameNetworkManagerPatch)); NetcodePatcher(); } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } internal class PluginLogger { private static ManualLogSource logSource; private static string errorSuffix = " (Tell Taskyy!)"; public static bool devLogsEnabled { get; private set; } public static void Load() { logSource = Logger.CreateLogSource("Taskyy.Chirpling".Split(".")[1]); if (devLogsEnabled = File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "debug.txt"))) { LogDebug("Debug logs enabled."); } } public static void Log(string message) { logSource.LogMessage((object)message); } public static void LogWarning(string message) { logSource.LogWarning((object)message); } public static void LogError(string message, bool append = true) { logSource.LogError((object)(message + (append ? errorSuffix : string.Empty))); } public static void LogDebug(string message) { if (devLogsEnabled) { logSource.Log((LogLevel)63, (object)("DEBUG: " + message)); } } public static void LogTest(string message) { logSource.LogMessage((object)(ConsoleColor.Blue.ToString() + message)); } } public static class PluginInfo { public const string PLUGIN_GUID = "Taskyy.Chirpling"; public const string PLUGIN_NAME = "Chirpling"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Chirpling.Patch { internal class GameNetworkManagerPatch { private static GameObject networkPrefab; [HarmonyPatch(typeof(GameNetworkManager))] [HarmonyPatch("Start")] [HarmonyPostfix] public static void Init() { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = AssetLoader.LoadPrefab("ChirplingNH"); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPatch(typeof(St