Decompiled source of Casual Difficulty v0.1.0
Assembly-CSharp.dll
Decompiled 8 months 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.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using AOT; using MilkShake; using Mirror; using Mirror.RemoteCalls; using Steamworks; using TMPro; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.XR; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [AddComponentMenu("Dynamic Bone/Dynamic Bone")] public class DynamicBone : MonoBehaviour { public enum UpdateMode { Normal, AnimatePhysics, UnscaledTime } public enum FreezeAxis { None, X, Y, Z } private class Particle { public Transform m_Transform; public int m_ParentIndex = -1; 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 Vector3 m_Position = Vector3.zero; public Vector3 m_PrevPosition = Vector3.zero; public Vector3 m_EndOffset = Vector3.zero; public Vector3 m_InitLocalPosition = Vector3.zero; public Quaternion m_InitLocalRotation = Quaternion.identity; } [Tooltip("The root of the transform hierarchy to apply physics.")] public Transform m_Root; [Tooltip("Internal physics simulation rate.")] public float m_UpdateRate = 120f; public UpdateMode m_UpdateMode; [Tooltip("How much the bones slowed down.")] [Range(0f, 1f)] public float m_Damping = 0.1f; public AnimationCurve m_DampingDistrib; [Tooltip("How much the force applied to return each bone to original orientation.")] [Range(0f, 1f)] public float m_Elasticity = 0.1f; public AnimationCurve m_ElasticityDistrib; [Tooltip("How much bone's original orientation are preserved.")] [Range(0f, 1f)] public float m_Stiffness = 0.1f; public AnimationCurve m_StiffnessDistrib; [Tooltip("How much character's position change is ignored in physics simulation.")] [Range(0f, 1f)] public float m_Inert; public AnimationCurve m_InertDistrib; [Tooltip("How much the bones slowed down when collide.")] public float m_Friction; public AnimationCurve m_FrictionDistrib; [Tooltip("Each bone can be a sphere to collide with colliders. Radius describe sphere's size.")] public float m_Radius; public AnimationCurve m_RadiusDistrib; [Tooltip("If End Length is not zero, an extra bone is generated at the end of transform hierarchy.")] public float m_EndLength; [Tooltip("If End Offset is not zero, an extra bone is generated at the end of transform hierarchy.")] public Vector3 m_EndOffset = Vector3.zero; [Tooltip("The force apply to bones. Partial force apply to character's initial pose is cancelled out.")] public Vector3 m_Gravity = Vector3.zero; [Tooltip("The force apply to bones.")] public Vector3 m_Force = Vector3.zero; [Tooltip("Collider objects interact with the bones.")] public List<DynamicBoneColliderBase> m_Colliders; [Tooltip("Bones exclude from physics simulation.")] public List<Transform> m_Exclusions; [Tooltip("Constrain bones to move on specified plane.")] public FreezeAxis m_FreezeAxis; [Tooltip("Disable physics simulation automatically if character is far from camera or player.")] public bool m_DistantDisable; public bool m_DisableByCameraFunc = true; public Transform m_ReferenceObject; public float m_DistanceToObject = 20f; private Vector3 m_LocalGravity = Vector3.zero; private Vector3 m_ObjectMove = Vector3.zero; private Vector3 m_ObjectPrevPosition = Vector3.zero; private float m_BoneTotalLength; private float m_ObjectScale = 1f; private float m_Time; private float m_Weight = 1f; private bool m_DistantDisabled; private List<Particle> m_Particles = new List<Particle>(); private void Start() { SetupParticles(); } private void FixedUpdate() { if (m_UpdateMode == UpdateMode.AnimatePhysics) { PreUpdate(); } } private void Update() { //IL_008b: 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) if (Object.op_Implicit((Object)(object)CameraFunction._current) && Object.op_Implicit((Object)(object)Player._mainPlayer) && m_DisableByCameraFunc) { if (Object.op_Implicit((Object)(object)((Component)this).GetComponentInParent<Player>())) { if (Object.op_Implicit((Object)(object)Player._mainPlayer) && Player._mainPlayer._playerZoneType != ((Component)this).GetComponentInParent<Player>()._playerZoneType) { m_DistantDisabled = true; } } else { m_DisableByCameraFunc = false; } if (Object.op_Implicit((Object)(object)Player._mainPlayer) && Player._mainPlayer._isHostPlayer && ((Component)Player._mainPlayer).gameObject.scene != ((Component)this).gameObject.scene) { m_DistantDisabled = true; } m_ReferenceObject = ((Component)CameraFunction._current._mainCamera).transform; m_DistantDisable = true; m_DistanceToObject = 85.6f; } if (!m_DisableByCameraFunc) { m_DistantDisable = false; } if (m_UpdateMode != UpdateMode.AnimatePhysics) { PreUpdate(); } } private void LateUpdate() { if (m_DistantDisable) { CheckDistance(); } if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled)) { float t = ((m_UpdateMode == UpdateMode.UnscaledTime) ? Time.unscaledDeltaTime : Time.deltaTime); UpdateDynamicBones(t); } } private void PreUpdate() { if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled)) { InitTransforms(); } } private void CheckDistance() { //IL_0032: 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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Transform val = m_ReferenceObject; if ((Object)(object)val == (Object)null && (Object)(object)Camera.main != (Object)null) { val = ((Component)Camera.main).transform; } if (!((Object)(object)val != (Object)null)) { return; } Vector3 val2 = val.position - ((Component)this).transform.position; bool flag = ((Vector3)(ref val2)).sqrMagnitude > m_DistanceToObject * m_DistanceToObject; if (flag != m_DistantDisabled) { if (!flag) { ResetParticlesPosition(); } m_DistantDisabled = flag; } } private void OnEnable() { 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) { InitTransforms(); SetupParticles(); } } private void OnDrawGizmosSelected() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)this).enabled || (Object)(object)m_Root == (Object)null) { return; } if (Application.isEditor && !Application.isPlaying && ((Component)this).transform.hasChanged) { InitTransforms(); SetupParticles(); } Gizmos.color = Color.white; for (int i = 0; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; if (particle.m_ParentIndex >= 0) { Particle particle2 = 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 = w; } } public float GetWeight() { return m_Weight; } private void UpdateDynamicBones(float t) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_Root == (Object)null) { return; } m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ObjectMove = ((Component)this).transform.position - m_ObjectPrevPosition; m_ObjectPrevPosition = ((Component)this).transform.position; int num = 1; if (m_UpdateRate > 0f) { float num2 = 1f / m_UpdateRate; m_Time += t; 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(); UpdateParticles2(); m_ObjectMove = Vector3.zero; } } else { SkipUpdateParticles(); } ApplyParticlesToTransforms(); } private void SetupParticles() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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) m_Particles.Clear(); if (!((Object)(object)m_Root == (Object)null)) { m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity); m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ObjectPrevPosition = ((Component)this).transform.position; m_ObjectMove = Vector3.zero; m_BoneTotalLength = 0f; AppendParticles(m_Root, -1, 0f); UpdateParameters(); } } private void AppendParticles(Transform b, int parentIndex, float boneLength) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f5: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) Particle particle = new Particle(); particle.m_Transform = b; 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 = 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))); } if (parentIndex >= 0) { float num = boneLength; val = m_Particles[parentIndex].m_Transform.position - particle.m_Position; boneLength = num + ((Vector3)(ref val)).magnitude; particle.m_BoneLength = boneLength; m_BoneTotalLength = Mathf.Max(m_BoneTotalLength, boneLength); } int count = m_Particles.Count; m_Particles.Add(particle); if (!((Object)(object)b != (Object)null)) { return; } for (int i = 0; i < b.childCount; i++) { bool flag = false; if (m_Exclusions != null) { for (int j = 0; j < m_Exclusions.Count; j++) { if ((Object)(object)m_Exclusions[j] == (Object)(object)b.GetChild(i)) { flag = true; break; } } } if (!flag) { AppendParticles(b.GetChild(i), count, boneLength); } else if (m_EndLength > 0f || m_EndOffset != Vector3.zero) { AppendParticles(null, count, boneLength); } } if (b.childCount == 0 && (m_EndLength > 0f || m_EndOffset != Vector3.zero)) { AppendParticles(null, count, boneLength); } } public void UpdateParameters() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_Root == (Object)null) { return; } m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity); for (int i = 0; i < m_Particles.Count; i++) { Particle particle = 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 (m_BoneTotalLength > 0f) { float num = particle.m_BoneLength / 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() { //IL_0026: 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 < m_Particles.Count; i++) { Particle particle = m_Particles[i]; if ((Object)(object)particle.m_Transform != (Object)null) { particle.m_Transform.localPosition = particle.m_InitLocalPosition; particle.m_Transform.localRotation = particle.m_InitLocalRotation; } } } private void ResetParticlesPosition() { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; if ((Object)(object)particle.m_Transform != (Object)null) { particle.m_Position = (particle.m_PrevPosition = particle.m_Transform.position); } else { Transform transform = m_Particles[particle.m_ParentIndex].m_Transform; particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset)); } particle.m_isCollide = false; } m_ObjectPrevPosition = ((Component)this).transform.position; } private void UpdateParticles1() { //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_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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00ae: 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) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) Vector3 gravity = m_Gravity; Vector3 normalized = ((Vector3)(ref m_Gravity)).normalized; Vector3 val = m_Root.TransformDirection(m_LocalGravity); Vector3 val2 = normalized * Mathf.Max(Vector3.Dot(val, normalized), 0f); gravity -= val2; gravity = (gravity + m_Force) * m_ObjectScale; for (int i = 0; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; if (particle.m_ParentIndex >= 0) { Vector3 val3 = particle.m_Position - particle.m_PrevPosition; Vector3 val4 = m_ObjectMove * 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_Transform.position; } } } private void UpdateParticles2() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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_0042: 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_0057: 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_00cb: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_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_0150: 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_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: 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) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: 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_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027b: 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_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); for (int i = 1; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; Particle particle2 = m_Particles[particle.m_ParentIndex]; Vector3 val2; float magnitude; if ((Object)(object)particle.m_Transform != (Object)null) { val2 = particle2.m_Transform.position - particle.m_Transform.position; magnitude = ((Vector3)(ref val2)).magnitude; } else { Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix; val2 = ((Matrix4x4)(ref localToWorldMatrix)).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 localToWorldMatrix2 = particle2.m_Transform.localToWorldMatrix; ((Matrix4x4)(ref localToWorldMatrix2)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val3 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition)); Vector3 val4 = val3 - particle.m_Position; particle.m_Position += val4 * particle.m_Elasticity; 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_Colliders != null) { float particleRadius = particle.m_Radius * m_ObjectScale; for (int j = 0; j < m_Colliders.Count; j++) { DynamicBoneColliderBase dynamicBoneColliderBase = m_Colliders[j]; if ((Object)(object)dynamicBoneColliderBase != (Object)null && ((Behaviour)dynamicBoneColliderBase).enabled) { particle.m_isCollide |= dynamicBoneColliderBase.Collide(ref particle.m_Position, particleRadius); } } } if (m_FreezeAxis != 0) { switch (m_FreezeAxis) { case FreezeAxis.X: ((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.right, particle2.m_Position); break; case FreezeAxis.Y: ((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.up, particle2.m_Position); break; case FreezeAxis.Z: ((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.forward, particle2.m_Position); break; } particle.m_Position -= ((Plane)(ref val)).normal * ((Plane)(ref val)).GetDistanceToPoint(particle.m_Position); } Vector3 val5 = particle2.m_Position - particle.m_Position; float magnitude3 = ((Vector3)(ref val5)).magnitude; if (magnitude3 > 0f) { particle.m_Position += val5 * ((magnitude3 - magnitude) / magnitude3); } } } private void SkipUpdateParticles() { //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_00e3: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_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_0130: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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) //IL_017b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; if (particle.m_ParentIndex >= 0) { particle.m_PrevPosition += m_ObjectMove; particle.m_Position += m_ObjectMove; Particle particle2 = m_Particles[particle.m_ParentIndex]; Vector3 val; float magnitude; if ((Object)(object)particle.m_Transform != (Object)null) { val = particle2.m_Transform.position - particle.m_Transform.position; magnitude = ((Vector3)(ref val)).magnitude; } else { Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix; val = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyVector(particle.m_EndOffset); magnitude = ((Vector3)(ref val)).magnitude; } float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight); if (num > 0f) { Matrix4x4 localToWorldMatrix2 = particle2.m_Transform.localToWorldMatrix; ((Matrix4x4)(ref localToWorldMatrix2)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val2 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition)); 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_Transform.position; } } } private static Vector3 MirrorVector(Vector3 v, Vector3 axis) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return v - axis * (Vector3.Dot(v, axis) * 2f); } private void ApplyParticlesToTransforms() { //IL_00b1: 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_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) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; Particle particle2 = m_Particles[particle.m_ParentIndex]; if (particle2.m_Transform.childCount <= 1) { Vector3 val = ((!((Object)(object)particle.m_Transform != (Object)null)) ? particle.m_EndOffset : particle.m_Transform.localPosition); Vector3 val2 = particle.m_Position - particle2.m_Position; Quaternion val3 = Quaternion.FromToRotation(particle2.m_Transform.TransformDirection(val), val2); particle2.m_Transform.rotation = val3 * particle2.m_Transform.rotation; } if ((Object)(object)particle.m_Transform != (Object)null) { particle.m_Transform.position = particle.m_Position; } } } } [AddComponentMenu("Dynamic Bone/Dynamic Bone Collider")] public class DynamicBoneCollider : DynamicBoneColliderBase { [Tooltip("The radius of the sphere or capsule.")] public float m_Radius = 0.5f; [Tooltip("The height of the capsule.")] public float m_Height; private void OnValidate() { m_Radius = Mathf.Max(m_Radius, 0f); m_Height = Mathf.Max(m_Height, 0f); } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_000c: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_011d: 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_0129: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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) float num = m_Radius * Mathf.Abs(((Component)this).transform.lossyScale.x); float num2 = m_Height * 0.5f - m_Radius; if (num2 <= 0f) { if (m_Bound == Bound.Outside) { return OutsideSphere(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(m_Center), num); } return InsideSphere(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(m_Center), num); } Vector3 center = m_Center; Vector3 center2 = m_Center; switch (m_Direction) { case Direction.X: center.x -= num2; center2.x += num2; break; case Direction.Y: center.y -= num2; center2.y += num2; break; case Direction.Z: center.z -= num2; center2.z += num2; break; } if (m_Bound == Bound.Outside) { return OutsideCapsule(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(center), ((Component)this).transform.TransformPoint(center2), num); } return InsideCapsule(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(center), ((Component)this).transform.TransformPoint(center2), num); } private static bool OutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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 > 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) { //IL_0009: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_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_0084: 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_00d8: 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_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) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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 sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude; if (num3 >= sqrMagnitude2) { val2 = particlePosition - capsuleP1; float sqrMagnitude3 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude3 > 0f && sqrMagnitude3 < num2) { float num5 = Mathf.Sqrt(sqrMagnitude3); particlePosition = capsuleP1 + val2 * (num / num5); return true; } } else if (sqrMagnitude2 > 0f) { num3 /= sqrMagnitude2; val2 -= val * num3; float sqrMagnitude4 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude4 > 0f && sqrMagnitude4 < num2) { float num6 = Mathf.Sqrt(sqrMagnitude4); particlePosition += val2 * ((num - num6) / num6); return true; } } } return false; } private static bool InsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius) { //IL_0009: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cb: 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_0097: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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 sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude; if (num3 >= sqrMagnitude2) { val2 = particlePosition - capsuleP1; float sqrMagnitude3 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude3 > num2) { float num5 = Mathf.Sqrt(sqrMagnitude3); particlePosition = capsuleP1 + val2 * (num / num5); return true; } } else if (sqrMagnitude2 > 0f) { num3 /= sqrMagnitude2; val2 -= val * num3; float sqrMagnitude4 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude4 > num2) { float num6 = Mathf.Sqrt(sqrMagnitude4); particlePosition += val2 * ((num - num6) / num6); return true; } } } return false; } private void OnDrawGizmosSelected() { //IL_001d: 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_0033: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0107: 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) if (!((Behaviour)this).enabled) { return; } if (m_Bound == Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } float num = m_Radius * Mathf.Abs(((Component)this).transform.lossyScale.x); float num2 = m_Height * 0.5f - m_Radius; if (num2 <= 0f) { Gizmos.DrawWireSphere(((Component)this).transform.TransformPoint(m_Center), num); return; } Vector3 center = m_Center; Vector3 center2 = m_Center; switch (m_Direction) { case Direction.X: center.x -= num2; center2.x += num2; break; case Direction.Y: center.y -= num2; center2.y += num2; break; case Direction.Z: center.z -= num2; center2.z += num2; break; } Gizmos.DrawWireSphere(((Component)this).transform.TransformPoint(center), num); Gizmos.DrawWireSphere(((Component)this).transform.TransformPoint(center2), num); } } public class DynamicBoneColliderBase : MonoBehaviour { public enum Direction { X, Y, Z } public enum Bound { Outside, Inside } [Tooltip("The axis of the capsule's height.")] public Direction m_Direction = Direction.Y; [Tooltip("The center of the sphere or capsule, in the object's local space.")] public Vector3 m_Center = Vector3.zero; [Tooltip("Constrain bones to outside bound or inside bound.")] public Bound m_Bound; public virtual bool Collide(ref Vector3 particlePosition, float particleRadius) { return false; } } [AddComponentMenu("Dynamic Bone/Dynamic Bone Plane Collider")] public class DynamicBonePlaneCollider : DynamicBoneColliderBase { private void OnValidate() { } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0069: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 val3 = default(Plane); ((Plane)(ref val3))..ctor(val, val2); float distanceToPoint = ((Plane)(ref val3)).GetDistanceToPoint(particlePosition); if (m_Bound == Bound.Outside) { if (distanceToPoint < 0f) { particlePosition -= val * distanceToPoint; return true; } } else if (distanceToPoint > 0f) { particlePosition -= val * distanceToPoint; return true; } return false; } private void OnDrawGizmosSelected() { //IL_001d: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { if (m_Bound == Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } 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); Gizmos.DrawLine(val2, val2 + val); } } } public enum GamepadType { Xbox360, XboxOne, XboxSeries, PS2, PS3, PS4, PS5, SteamController, PcGamepad, SwitchPro, SwitchJoyconL, SwitchJoyconR, COUNT, Keyboard } public enum GamepadPlatform { Windows, MacOS, Linux, COUNT, INVALID } public enum GamepadStick { LeftStick, RightStick, DPad, COUNT, INVALID } public enum GamepadAxis { LeftX, LeftY, RightX, RightY, DPadX, DPadY, LeftTrigger, RightTrigger, COUNT, INVALID } public enum GamepadButton { Button_South, Button_East, Button_West, Button_North, DPad_Up, DPad_Down, DPad_Left, DPad_Right, LeftShoulder, LeftTrigger, LeftStick, RightShoulder, RightTrigger, RightStick, Back, Start, Center, Special, LeftStick_Up, LeftStick_Down, LeftStick_Left, LeftStick_Right, RightStick_Up, RightStick_Down, RightStick_Left, RightStick_Right, COUNT, INVALID } [Serializable] public struct GamepadInfo { public int id; public GamepadType type; public GamepadInfo(int id, GamepadType type) { this.id = id; this.type = type; } } public class GamepadInput : MonoBehaviour { [Serializable] private class PlatformMappings { public string name; public GamepadMapping[] data; public PlatformMappings(string name) { this.name = name; } } [Serializable] private class GamepadMapping { public string name; public int[] axisIndexes; public Vector2[] axisRange; public int[] buttonIndexes; public GamepadMapping(string name, int[] axisIndexes, Vector2[] axisRange, int[] buttonIndexes) { this.name = name; this.axisIndexes = axisIndexes; this.axisRange = axisRange; this.buttonIndexes = buttonIndexes; } private bool HasButton(GamepadButton button) { return (int)button < buttonIndexes.Length; } public int GetButtonIndex(GamepadButton button) { if (HasButton(button)) { return buttonIndexes[(int)button]; } return -1; } private bool HasAxis(GamepadAxis axis) { return (int)axis < axisIndexes.Length; } public int GetAxisIndex(GamepadAxis axis) { if (HasAxis(axis)) { return axisIndexes[(int)axis]; } return -1; } public Vector2 GetAxisRange(GamepadAxis axis) { //IL_0020: 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) if (HasAxis(axis)) { return axisRange[(int)axis]; } return new Vector2(0f, 1f); } } [Serializable] private class GamepadRawData { public int id; public bool[] buttons; public float[] axes; } [SerializeField] private GamepadPlatform currentPlatform; [SerializeField] private PlatformMappings[] mappings; public TextAsset mappingsData; private GamepadRawData[] gamepadRawData; private GamepadRawData[] oldGamepadRawData; private static bool updatedThisFrame = false; private const float axisPressThreshold = 0.3f; private const int MIN_GAMEPAD_ID = 1; private const int MAX_GAMEPAD_ID = 4; private const int NUM_GAMEPADS = 5; private const int MIN_RAW_AXIS_ID = 1; private const int MAX_RAW_AXIS_ID = 12; private const int NUM_RAW_AXES = 13; private const int MIN_RAW_BUTTON_ID = 0; private const int MAX_RAW_BUTTON_ID = 19; private const int NUM_RAW_BUTTONS = 20; private const int JOYSTICK_BUTTON_BASE = 350; private const int JOYSTICK_BUTTON_DELTA = 20; private const int NUM_GAMEPAD_TYPES = 12; private const int NUM_PLATFORMS = 3; private const int NUM_STICKS = 3; private const int NUM_AXES = 8; private const int NUM_BUTTONS = 26; private const int NUM_MAPPED_AXES = 8; private const int NUM_MAPPED_BUTTONS = 18; private static readonly Vector2 V_10 = new Vector2(-1f, 0f); private static readonly Vector2 V_11 = new Vector2(-1f, 1f); private static readonly Vector2 V0_1 = new Vector2(0f, -1f); private static readonly Vector2 V01 = new Vector2(0f, 1f); private static readonly Vector2 V1_1 = new Vector2(1f, -1f); private static readonly Vector2 V10 = new Vector2(1f, 0f); private static readonly Vector2 V_invalid = new Vector2(0f, 1f); private static GamepadInput instance; private static GamepadPlatform CurrentPlatform => Instance.currentPlatform; public static GamepadInput Instance { get { if ((Object)(object)instance == (Object)null) { instance = Object.FindObjectOfType<GamepadInput>(); } return instance; } } private void Awake() { oldGamepadRawData = ReadAllRawData(); gamepadRawData = ReadAllRawData(); } private void PreUpdate() { updatedThisFrame = true; oldGamepadRawData = gamepadRawData; gamepadRawData = ReadAllRawData(); } private void LateUpdate() { updatedThisFrame = false; } public static bool GetButton(GamepadButton button, GamepadInfo gamepadInfo) { if (!IsValidGamepadId(gamepadInfo.id)) { return false; } CheckPreUpdate(); GamepadMapping mapping = GetMapping(gamepadInfo, CurrentPlatform); GamepadRawData rawData = GetRawData(gamepadInfo); int buttonIndex = mapping.GetButtonIndex(button); if (0 <= buttonIndex && buttonIndex < rawData.buttons.Length) { return rawData.buttons[buttonIndex]; } return TryObtainButtonFromAxisValue(button, mapping, rawData); } public static bool GetButtonDown(GamepadButton button, GamepadInfo gamepadInfo) { if (!IsValidGamepadId(gamepadInfo.id)) { return false; } CheckPreUpdate(); GamepadMapping mapping = GetMapping(gamepadInfo, CurrentPlatform); GamepadRawData rawData = GetRawData(gamepadInfo); GamepadRawData oldRawData = GetOldRawData(gamepadInfo); int buttonIndex = mapping.GetButtonIndex(button); if (0 <= buttonIndex && buttonIndex < rawData.buttons.Length) { bool num = oldRawData.buttons[buttonIndex]; bool flag = rawData.buttons[buttonIndex]; return !num && flag; } bool num2 = TryObtainButtonFromAxisValue(button, mapping, oldRawData); bool flag2 = TryObtainButtonFromAxisValue(button, mapping, rawData); return !num2 && flag2; } public static bool GetButtonUp(GamepadButton button, GamepadInfo gamepadInfo) { if (!IsValidGamepadId(gamepadInfo.id)) { return false; } CheckPreUpdate(); GamepadMapping mapping = GetMapping(gamepadInfo, CurrentPlatform); GamepadRawData rawData = GetRawData(gamepadInfo); GamepadRawData oldRawData = GetOldRawData(gamepadInfo); int buttonIndex = mapping.GetButtonIndex(button); if (0 <= buttonIndex && buttonIndex < rawData.buttons.Length) { bool num = oldRawData.buttons[buttonIndex]; bool flag = rawData.buttons[buttonIndex]; if (num) { return !flag; } return false; } bool num2 = TryObtainButtonFromAxisValue(button, mapping, oldRawData); bool flag2 = TryObtainButtonFromAxisValue(button, mapping, rawData); if (num2) { return !flag2; } return false; } public static float GetAxis(GamepadAxis axis, GamepadInfo gamepadInfo) { //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_0054: Unknown result type (might be due to invalid IL or missing references) if (!IsValidGamepadId(gamepadInfo.id)) { return 0f; } CheckPreUpdate(); GamepadMapping mapping = GetMapping(gamepadInfo, CurrentPlatform); GamepadRawData rawData = GetRawData(gamepadInfo); int axisIndex = mapping.GetAxisIndex(axis); if (0 <= axisIndex && axisIndex < rawData.axes.Length) { float value = rawData.axes[axisIndex]; Vector2 axisRange = mapping.GetAxisRange(axis); return Remap(value, axisRange, GetOutputRange(axis)); } return TryObtainAxisValueFromButtons(axis, mapping, rawData); } public static Vector2 GetStick(GamepadStick stick, GamepadInfo gamepadInfo) { //IL_0030: 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) if (!IsValidGamepadId(gamepadInfo.id)) { return Vector2.zero; } CheckPreUpdate(); float axis = GetAxis((GamepadAxis)((int)stick * 2), gamepadInfo); float axis2 = GetAxis((GamepadAxis)((int)stick * 2 + 1), gamepadInfo); return new Vector2(axis, axis2); } private static void CheckPreUpdate() { if (!updatedThisFrame) { Instance.PreUpdate(); } } [ContextMenu("Apply Mappings")] private void ApplyMappings() { Instance.mappings = ParseMappings(instance.mappingsData); } private static GamepadRawData[] ReadAllRawData() { GamepadRawData[] array = new GamepadRawData[5]; for (int i = 1; i <= 4; i++) { array[i] = ReadRawdata(i); } return array; } private static GamepadRawData ReadRawdata(int gamepadId) { //IL_002c: 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) GamepadRawData gamepadRawData = new GamepadRawData(); gamepadRawData.id = gamepadId; gamepadRawData.buttons = new bool[20]; for (int i = 0; i <= 19; i++) { KeyCode val = (KeyCode)(350 + 20 * (gamepadId - 1) + i); gamepadRawData.buttons[i] = Input.GetKey(val); } gamepadRawData.axes = new float[13]; for (int j = 1; j <= 12; j++) { gamepadRawData.axes[j] = Input.GetAxisRaw($"Joystick{gamepadId}_Axis{j}"); } return gamepadRawData; } private static GamepadRawData GetRawData(GamepadInfo gamepadInfo) { return Instance.gamepadRawData[gamepadInfo.id]; } private static GamepadRawData GetOldRawData(GamepadInfo gamepadInfo) { return Instance.oldGamepadRawData[gamepadInfo.id]; } private static GamepadMapping GetMapping(GamepadInfo gamepadInfo, GamepadPlatform platform) { return Instance.mappings[(int)platform].data[(int)gamepadInfo.type]; } private static PlatformMappings[] ParseMappings(TextAsset textAsset) { //IL_005c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) string[] array = textAsset.text.Split(new char[2] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); string[][] array2 = new string[array.Length][]; for (int i = 0; i < array.Length; i++) { array2[i] = array[i].Split(new char[1] { '\t' }, StringSplitOptions.None); } Dictionary<string, Vector2> dictionary = new Dictionary<string, Vector2> { { "-1_0", V_10 }, { "-1_1", V_11 }, { "0_-1", V0_1 }, { "0_1", V01 }, { "1_-1", V1_1 }, { "1_0", V10 } }; PlatformMappings[] array3 = new PlatformMappings[3]; for (int j = 0; j < 3; j++) { GamepadPlatform gamepadPlatform = (GamepadPlatform)j; string name = gamepadPlatform.ToString(); array3[j] = new PlatformMappings(name); array3[j].data = new GamepadMapping[12]; for (int k = 0; k < 12; k++) { GamepadType gamepadType = (GamepadType)k; string name2 = gamepadType.ToString(); int[] array4 = new int[8]; Vector2[] array5 = (Vector2[])(object)new Vector2[8]; int[] array6 = new int[18]; int num = k * 3 + j; for (int l = 0; l < 8; l++) { if (int.TryParse(array2[l][num], out var result)) { array4[l] = result; } else { array4[l] = -1; } } for (int m = 0; m < 8; m++) { string text = array2[m + 8][num]; text = text.Trim(); if (dictionary.ContainsKey(text)) { array5[m] = dictionary[text]; } else { array5[m] = V_invalid; } } for (int n = 0; n < 18; n++) { if (int.TryParse(array2[n + 16][num], out var result2)) { array6[n] = result2; } else { array6[n] = -1; } } array3[j].data[k] = new GamepadMapping(name2, array4, array5, array6); } } return array3; } private static float Remap(float value, Vector2 from, Vector2 to) { //IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return Remap(value, new Vector4(from.x, from.y, to.x, to.y)); } private static float Remap(float value, Vector4 range) { //IL_0000: 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_0015: Unknown result type (might be due to invalid IL or missing references) float x = range.x; float y = range.y; float z = range.z; float w = range.w; return z + (w - z) * ((value - x) / (y - x)); } private static Vector2 GetOutputRange(GamepadAxis axis) { //IL_001e: 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) if (axis < GamepadAxis.LeftTrigger) { return new Vector2(-1f, 1f); } return new Vector2(0f, 1f); } private static bool TryObtainButtonFromAxisValue(GamepadButton button, GamepadMapping mapping, GamepadRawData data) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) GamepadAxis axis = AxisFromButton(button); int axisIndex = mapping.GetAxisIndex(axis); if (0 <= axisIndex && axisIndex < data.axes.Length) { float value = data.axes[axisIndex]; Vector2 axisRange = mapping.GetAxisRange(axis); float num = Remap(value, axisRange, GetOutputRange(axis)); int num2 = SignFromButton(button); return num * (float)num2 >= 0.3f; } return false; } private static float TryObtainAxisValueFromButtons(GamepadAxis axis, GamepadMapping mapping, GamepadRawData data) { GamepadButton button = NegativeButtonFromAxis(axis); GamepadButton button2 = PositiveButtonFromAxis(axis); bool flag = false; int buttonIndex = mapping.GetButtonIndex(button); if (0 <= buttonIndex && buttonIndex < data.buttons.Length) { flag = data.buttons[buttonIndex]; } bool flag2 = false; int buttonIndex2 = mapping.GetButtonIndex(button2); if (0 <= buttonIndex2 && buttonIndex2 < data.buttons.Length) { flag2 = data.buttons[buttonIndex2]; } float num = 0f; if (flag) { num -= 1f; } if (flag2) { num += 1f; } return num; } private static GamepadAxis AxisFromButton(GamepadButton button) { return button switch { GamepadButton.LeftTrigger => GamepadAxis.LeftTrigger, GamepadButton.RightTrigger => GamepadAxis.RightTrigger, GamepadButton.DPad_Up => GamepadAxis.DPadY, GamepadButton.DPad_Down => GamepadAxis.DPadY, GamepadButton.DPad_Left => GamepadAxis.DPadX, GamepadButton.DPad_Right => GamepadAxis.DPadX, GamepadButton.LeftStick_Up => GamepadAxis.LeftY, GamepadButton.LeftStick_Down => GamepadAxis.LeftY, GamepadButton.LeftStick_Left => GamepadAxis.LeftX, GamepadButton.LeftStick_Right => GamepadAxis.LeftX, GamepadButton.RightStick_Up => GamepadAxis.RightY, GamepadButton.RightStick_Down => GamepadAxis.RightY, GamepadButton.RightStick_Left => GamepadAxis.RightX, GamepadButton.RightStick_Right => GamepadAxis.RightX, _ => GamepadAxis.INVALID, }; } private static int SignFromButton(GamepadButton button) { return button switch { GamepadButton.LeftTrigger => 1, GamepadButton.RightTrigger => 1, GamepadButton.DPad_Up => 1, GamepadButton.DPad_Down => -1, GamepadButton.DPad_Left => -1, GamepadButton.DPad_Right => 1, GamepadButton.LeftStick_Up => 1, GamepadButton.LeftStick_Down => -1, GamepadButton.LeftStick_Left => -1, GamepadButton.LeftStick_Right => 1, GamepadButton.RightStick_Up => 1, GamepadButton.RightStick_Down => -1, GamepadButton.RightStick_Left => -1, GamepadButton.RightStick_Right => 1, _ => 0, }; } private static GamepadButton NegativeButtonFromAxis(GamepadAxis axis) { return axis switch { GamepadAxis.LeftTrigger => GamepadButton.INVALID, GamepadAxis.RightTrigger => GamepadButton.INVALID, GamepadAxis.DPadX => GamepadButton.DPad_Left, GamepadAxis.DPadY => GamepadButton.DPad_Down, GamepadAxis.LeftX => GamepadButton.LeftStick_Left, GamepadAxis.LeftY => GamepadButton.LeftStick_Down, GamepadAxis.RightX => GamepadButton.RightStick_Left, GamepadAxis.RightY => GamepadButton.RightStick_Down, _ => GamepadButton.INVALID, }; } private static GamepadButton PositiveButtonFromAxis(GamepadAxis axis) { return axis switch { GamepadAxis.LeftTrigger => GamepadButton.LeftTrigger, GamepadAxis.RightTrigger => GamepadButton.RightTrigger, GamepadAxis.DPadX => GamepadButton.DPad_Right, GamepadAxis.DPadY => GamepadButton.DPad_Up, GamepadAxis.LeftX => GamepadButton.LeftStick_Right, GamepadAxis.LeftY => GamepadButton.LeftStick_Up, GamepadAxis.RightX => GamepadButton.RightStick_Right, GamepadAxis.RightY => GamepadButton.RightStick_Up, _ => GamepadButton.INVALID, }; } private static bool IsValidGamepadId(int id) { if (1 <= id) { return id <= 4; } return false; } } public class Interpolate { public enum EaseType { Linear, EaseInQuad, EaseOutQuad, EaseInOutQuad, EaseInCubic, EaseOutCubic, EaseInOutCubic, EaseInQuart, EaseOutQuart, EaseInOutQuart, EaseInQuint, EaseOutQuint, EaseInOutQuint, EaseInSine, EaseOutSine, EaseInOutSine, EaseInExpo, EaseOutExpo, EaseInOutExpo, EaseInCirc, EaseOutCirc, EaseInOutCirc } public delegate Vector3 ToVector3<T>(T v); public delegate float Function(float a, float b, float c, float d); private static Vector3 Identity(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return v; } private static Vector3 TransformDotPosition(Transform t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return t.position; } private static IEnumerable<float> NewTimer(float duration) { float elapsedTime = 0f; while (elapsedTime < duration) { yield return elapsedTime; elapsedTime += Time.deltaTime; if (elapsedTime >= duration) { yield return elapsedTime; } } } private static IEnumerable<float> NewCounter(int start, int end, int step) { for (int i = start; i <= end; i += step) { yield return i; } } public static IEnumerator NewEase(Function ease, Vector3 start, Vector3 end, float duration) { //IL_0008: 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) IEnumerable<float> driver = NewTimer(duration); return NewEase(ease, start, end, duration, driver); } public static IEnumerator NewEase(Function ease, Vector3 start, Vector3 end, int slices) { //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) IEnumerable<float> driver = NewCounter(0, slices + 1, 1); return NewEase(ease, start, end, slices + 1, driver); } private static IEnumerator NewEase(Function ease, Vector3 start, Vector3 end, float total, IEnumerable<float> driver) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 distance = end - start; foreach (float item in driver) { yield return Ease(ease, start, distance, item, total); } } private static Vector3 Ease(Function ease, Vector3 start, Vector3 distance, float elapsedTime, float duration) { //IL_0003: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: Unknown result type (might be due to invalid IL or missing references) start.x = ease(start.x, distance.x, elapsedTime, duration); start.y = ease(start.y, distance.y, elapsedTime, duration); start.z = ease(start.z, distance.z, elapsedTime, duration); return start; } public static Function Ease(EaseType type) { Function result = null; switch (type) { case EaseType.Linear: result = Linear; break; case EaseType.EaseInQuad: result = EaseInQuad; break; case EaseType.EaseOutQuad: result = EaseOutQuad; break; case EaseType.EaseInOutQuad: result = EaseInOutQuad; break; case EaseType.EaseInCubic: result = EaseInCubic; break; case EaseType.EaseOutCubic: result = EaseOutCubic; break; case EaseType.EaseInOutCubic: result = EaseInOutCubic; break; case EaseType.EaseInQuart: result = EaseInQuart; break; case EaseType.EaseOutQuart: result = EaseOutQuart; break; case EaseType.EaseInOutQuart: result = EaseInOutQuart; break; case EaseType.EaseInQuint: result = EaseInQuint; break; case EaseType.EaseOutQuint: result = EaseOutQuint; break; case EaseType.EaseInOutQuint: result = EaseInOutQuint; break; case EaseType.EaseInSine: result = EaseInSine; break; case EaseType.EaseOutSine: result = EaseOutSine; break; case EaseType.EaseInOutSine: result = EaseInOutSine; break; case EaseType.EaseInExpo: result = EaseInExpo; break; case EaseType.EaseOutExpo: result = EaseOutExpo; break; case EaseType.EaseInOutExpo: result = EaseInOutExpo; break; case EaseType.EaseInCirc: result = EaseInCirc; break; case EaseType.EaseOutCirc: result = EaseOutCirc; break; case EaseType.EaseInOutCirc: result = EaseInOutCirc; break; } return result; } public static IEnumerable<Vector3> NewBezier(Function ease, Transform[] nodes, float duration) { IEnumerable<float> steps = NewTimer(duration); return NewBezier<Transform>(ease, nodes, TransformDotPosition, duration, steps); } public static IEnumerable<Vector3> NewBezier(Function ease, Transform[] nodes, int slices) { IEnumerable<float> steps = NewCounter(0, slices + 1, 1); return NewBezier<Transform>(ease, nodes, TransformDotPosition, slices + 1, steps); } public static IEnumerable<Vector3> NewBezier(Function ease, Vector3[] points, float duration) { IEnumerable<float> steps = NewTimer(duration); return NewBezier<Vector3>(ease, points, Identity, duration, steps); } public static IEnumerable<Vector3> NewBezier(Function ease, Vector3[] points, int slices) { IEnumerable<float> steps = NewCounter(0, slices + 1, 1); return NewBezier<Vector3>(ease, points, Identity, slices + 1, steps); } private static IEnumerable<Vector3> NewBezier<T>(Function ease, IList nodes, ToVector3<T> toVector3, float maxStep, IEnumerable<float> steps) { if (nodes.Count < 2) { yield break; } Vector3[] points = (Vector3[])(object)new Vector3[nodes.Count]; foreach (float step in steps) { for (int i = 0; i < nodes.Count; i++) { points[i] = toVector3((T)nodes[i]); } yield return Bezier(ease, points, step, maxStep); } } private static Vector3 Bezier(Function ease, Vector3[] points, float elapsedTime, float duration) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) for (int num = points.Length - 1; num > 0; num--) { for (int i = 0; i < num; i++) { points[i].x = ease(points[i].x, points[i + 1].x - points[i].x, elapsedTime, duration); points[i].y = ease(points[i].y, points[i + 1].y - points[i].y, elapsedTime, duration); points[i].z = ease(points[i].z, points[i + 1].z - points[i].z, elapsedTime, duration); } } return points[0]; } public static IEnumerable<Vector3> NewCatmullRom(Transform[] nodes, int slices, bool loop) { return NewCatmullRom<Transform>(nodes, TransformDotPosition, slices, loop); } public static IEnumerable<Vector3> NewCatmullRom(Vector3[] points, int slices, bool loop) { return NewCatmullRom<Vector3>(points, Identity, slices, loop); } private static IEnumerable<Vector3> NewCatmullRom<T>(IList nodes, ToVector3<T> toVector3, int slices, bool loop) { if (nodes.Count < 2) { yield break; } yield return toVector3((T)nodes[0]); int last = nodes.Count - 1; for (int current = 0; loop || current < last; current++) { if (loop && current > last) { current = 0; } int previous = ((current != 0) ? (current - 1) : (loop ? last : current)); int start = current; int end = ((current != last) ? (current + 1) : ((!loop) ? current : 0)); int next = ((end != last) ? (end + 1) : ((!loop) ? end : 0)); int stepCount = slices + 1; for (int step = 1; step <= stepCount; step++) { yield return CatmullRom(toVector3((T)nodes[previous]), toVector3((T)nodes[start]), toVector3((T)nodes[end]), toVector3((T)nodes[next]), step, stepCount); } } } private static Vector3 CatmullRom(Vector3 previous, Vector3 start, Vector3 end, Vector3 next, float elapsedTime, float duration) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) float num = elapsedTime / duration; float num2 = num * num; float num3 = num2 * num; return previous * (-0.5f * num3 + num2 - 0.5f * num) + start * (1.5f * num3 + -2.5f * num2 + 1f) + end * (-1.5f * num3 + 2f * num2 + 0.5f * num) + next * (0.5f * num3 - 0.5f * num2); } private static float Linear(float start, float distance, float elapsedTime, float duration) { if (elapsedTime > duration) { elapsedTime = duration; } return distance * (elapsedTime / duration) + start; } private static float EaseInQuad(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); return distance * elapsedTime * elapsedTime + start; } private static float EaseOutQuad(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); return (0f - distance) * elapsedTime * (elapsedTime - 2f) + start; } private static float EaseInOutQuad(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 2f : (elapsedTime / (duration / 2f))); if (elapsedTime < 1f) { return distance / 2f * elapsedTime * elapsedTime + start; } elapsedTime -= 1f; return (0f - distance) / 2f * (elapsedTime * (elapsedTime - 2f) - 1f) + start; } private static float EaseInCubic(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); return distance * elapsedTime * elapsedTime * elapsedTime + start; } private static float EaseOutCubic(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); elapsedTime -= 1f; return distance * (elapsedTime * elapsedTime * elapsedTime + 1f) + start; } private static float EaseInOutCubic(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 2f : (elapsedTime / (duration / 2f))); if (elapsedTime < 1f) { return distance / 2f * elapsedTime * elapsedTime * elapsedTime + start; } elapsedTime -= 2f; return distance / 2f * (elapsedTime * elapsedTime * elapsedTime + 2f) + start; } private static float EaseInQuart(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); return distance * elapsedTime * elapsedTime * elapsedTime * elapsedTime + start; } private static float EaseOutQuart(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); elapsedTime -= 1f; return (0f - distance) * (elapsedTime * elapsedTime * elapsedTime * elapsedTime - 1f) + start; } private static float EaseInOutQuart(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 2f : (elapsedTime / (duration / 2f))); if (elapsedTime < 1f) { return distance / 2f * elapsedTime * elapsedTime * elapsedTime * elapsedTime + start; } elapsedTime -= 2f; return (0f - distance) / 2f * (elapsedTime * elapsedTime * elapsedTime * elapsedTime - 2f) + start; } private static float EaseInQuint(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); return distance * elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + start; } private static float EaseOutQuint(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); elapsedTime -= 1f; return distance * (elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + 1f) + start; } private static float EaseInOutQuint(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 2f : (elapsedTime / (duration / 2f))); if (elapsedTime < 1f) { return distance / 2f * elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + start; } elapsedTime -= 2f; return distance / 2f * (elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + 2f) + start; } private static float EaseInSine(float start, float distance, float elapsedTime, float duration) { if (elapsedTime > duration) { elapsedTime = duration; } return (0f - distance) * Mathf.Cos(elapsedTime / duration * (MathF.PI / 2f)) + distance + start; } private static float EaseOutSine(float start, float distance, float elapsedTime, float duration) { if (elapsedTime > duration) { elapsedTime = duration; } return distance * Mathf.Sin(elapsedTime / duration * (MathF.PI / 2f)) + start; } private static float EaseInOutSine(float start, float distance, float elapsedTime, float duration) { if (elapsedTime > duration) { elapsedTime = duration; } return (0f - distance) / 2f * (Mathf.Cos(MathF.PI * elapsedTime / duration) - 1f) + start; } private static float EaseInExpo(float start, float distance, float elapsedTime, float duration) { if (elapsedTime > duration) { elapsedTime = duration; } return distance * Mathf.Pow(2f, 10f * (elapsedTime / duration - 1f)) + start; } private static float EaseOutExpo(float start, float distance, float elapsedTime, float duration) { if (elapsedTime > duration) { elapsedTime = duration; } return distance * (0f - Mathf.Pow(2f, -10f * elapsedTime / duration) + 1f) + start; } private static float EaseInOutExpo(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 2f : (elapsedTime / (duration / 2f))); if (elapsedTime < 1f) { return distance / 2f * Mathf.Pow(2f, 10f * (elapsedTime - 1f)) + start; } elapsedTime -= 1f; return distance / 2f * (0f - Mathf.Pow(2f, -10f * elapsedTime) + 2f) + start; } private static float EaseInCirc(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); return (0f - distance) * (Mathf.Sqrt(1f - elapsedTime * elapsedTime) - 1f) + start; } private static float EaseOutCirc(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 1f : (elapsedTime / duration)); elapsedTime -= 1f; return distance * Mathf.Sqrt(1f - elapsedTime * elapsedTime) + start; } private static float EaseInOutCirc(float start, float distance, float elapsedTime, float duration) { elapsedTime = ((elapsedTime > duration) ? 2f : (elapsedTime / (duration / 2f))); if (elapsedTime < 1f) { return (0f - distance) / 2f * (Mathf.Sqrt(1f - elapsedTime * elapsedTime) - 1f) + start; } elapsedTime -= 2f; return distance / 2f * (Mathf.Sqrt(1f - elapsedTime * elapsedTime) + 1f) + start; } } public class MeleeWeaponTrail : MonoBehaviour { [Serializable] public class Point { public float timeCreated; public Vector3 basePosition; public Vector3 tipPosition; } private Player _parentPlayer; private GameObject _trailObject; private Mesh _trailMesh; private Vector3 _lastPosition; [SerializeField] private bool _emit = true; [SerializeField] private float _emitTime; [SerializeField] private Material _material; public float _lifeTime = 1f; public Color[] _colors = (Color[])(object)new Color[0]; public float[] _sizes = new float[0]; [SerializeField] private float _minVertexDistance = 0.025f; [SerializeField] private float _maxVertexDistance = 40f; private float _minVertexDistanceSqr; private float _maxVertexDistanceSqr; [SerializeField] private float _maxAngle = 12f; [SerializeField] private int subdivisions = 16; public Transform _base; public Transform _tip; private List<Point> _points = new List<Point>(); private List<Point> _smoothedPoints = new List<Point>(); private bool _trailObjectInitalized; public bool Emit { set { _emit = value; } } private void Start() { ((MonoBehaviour)this).StartCoroutine(Init_TrailObject()); } private IEnumerator Init_TrailObject() { _parentPlayer = ((Component)this).GetComponentInParent<Player>(); if (Object.op_Implicit((Object)(object)_parentPlayer)) { if (Object.op_Implicit((Object)(object)Player._mainPlayer) && (Object)(object)_parentPlayer == (Object)(object)Player._mainPlayer) { yield return (object)new WaitForSeconds(0.005f); } if (Object.op_Implicit((Object)(object)Player._mainPlayer) && (Object)(object)_parentPlayer != (Object)(object)Player._mainPlayer) { yield return (object)new WaitForSeconds(0.0625f); } _lastPosition = ((Component)this).transform.position; _trailObject = new GameObject(); _trailObject.transform.SetParent(((Component)this).transform); _trailObject.transform.SetParent((Transform)null); _trailObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); _trailObject.transform.localScale = Vector3.one; _trailObject.AddComponent(typeof(MeshFilter)); _trailObject.AddComponent(typeof(MeshRenderer)); _trailObject.GetComponent<Renderer>().material = _material; _trailMesh = new Mesh(); _trailMesh.indexFormat = (IndexFormat)1; ((Object)_trailMesh).name = ((Object)this).name + "TrailMesh"; _trailObject.GetComponent<MeshFilter>().mesh = _trailMesh; _minVertexDistanceSqr = _minVertexDistance * _minVertexDistance; _maxVertexDistanceSqr = _maxVertexDistance * _maxVertexDistance; ((Object)_trailObject).name = "_wepTrailMesh_(" + _parentPlayer._nickname + ")"; _trailObjectInitalized = true; } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_trailMesh)) { Object.Destroy((Object)(object)_trailMesh); } if (Object.op_Implicit((Object)(object)_trailObject)) { Object.Destroy((Object)(object)_trailObject); } } private void Update() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be