Decompiled source of Vision DMR SMG v1.1.0

Vision_DMR_SMG.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OpenScripts2;
using OtherLoader;
using Steamworks;
using UnityEditor;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[ExecuteInEditMode]
public class HolographicSightCustom : MonoBehaviour
{
	public Transform VirtualQuad;

	public float Scale = 1f;

	public bool SizeCompensation = true;

	private MaterialPropertyBlock m_block;

	private void OnEnable()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		m_block = new MaterialPropertyBlock();
		((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
	}

	private void OnWillRenderObject()
	{
		//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_001c: 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_0029: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position);
		m_block.SetVector("_Offset", Vector4.op_Implicit(val));
		m_block.SetFloat("_Scale", Scale);
		m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f);
		((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
	}
}
namespace Niko666.Vision_DMR_SMG
{
	[BepInPlugin("Niko666.Vision_DMR_SMG", "Vision_DMR_SMG", "1.1.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Vision_DMR_SMGPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Niko666.Vision_DMR_SMG");
			OtherLoader.RegisterDirectLoad(BasePath, "Niko666.Vision_DMR_SMG", "", "", "vision", "");
		}
	}
}
public class DynamicBoneDemo1 : MonoBehaviour
{
	public GameObject m_Player;

	private float m_weight = 1f;

	private void Update()
	{
		//IL_002c: 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_0056: 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_006a: Unknown result type (might be due to invalid IL or missing references)
		m_Player.transform.Rotate(new Vector3(0f, Input.GetAxis("Horizontal") * Time.deltaTime * 200f, 0f));
		m_Player.transform.Translate(((Component)this).transform.forward * Input.GetAxis("Vertical") * Time.deltaTime * 4f);
	}

	private void OnGUI()
	{
		//IL_0015: 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_007f: 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_00e3: 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_0137: Unknown result type (might be due to invalid IL or missing references)
		GUI.Label(new Rect(50f, 50f, 200f, 24f), "Press arrow key to move");
		Animation componentInChildren = m_Player.GetComponentInChildren<Animation>();
		((Behaviour)componentInChildren).enabled = GUI.Toggle(new Rect(50f, 70f, 200f, 24f), ((Behaviour)componentInChildren).enabled, "Play Animation");
		DynamicBone[] components = m_Player.GetComponents<DynamicBone>();
		GUI.Label(new Rect(50f, 100f, 200f, 24f), "Choose dynamic bone:");
		DynamicBone obj = components[0];
		bool enabled = GUI.Toggle(new Rect(50f, 120f, 100f, 24f), ((Behaviour)components[0]).enabled, "Breasts");
		((Behaviour)components[1]).enabled = enabled;
		((Behaviour)obj).enabled = enabled;
		((Behaviour)components[2]).enabled = GUI.Toggle(new Rect(50f, 140f, 100f, 24f), ((Behaviour)components[2]).enabled, "Tail");
		GUI.Label(new Rect(50f, 160f, 200f, 24f), "Weight");
		m_weight = GUI.HorizontalSlider(new Rect(100f, 160f, 100f, 24f), m_weight, 0f, 1f);
		DynamicBone[] array = components;
		foreach (DynamicBone dynamicBone in array)
		{
			dynamicBone.SetWeight(m_weight);
		}
	}
}
[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 = null;

		public int m_ParentIndex = -1;

		public float m_Damping = 0f;

		public float m_Elasticity = 0f;

		public float m_Stiffness = 0f;

		public float m_Inert = 0f;

		public float m_Friction = 0f;

		public float m_Radius = 0f;

		public float m_BoneLength = 0f;

		public bool m_isCollide = false;

		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 = null;

	[Tooltip("Internal physics simulation rate.")]
	public float m_UpdateRate = 60f;

	public UpdateMode m_UpdateMode = UpdateMode.Normal;

	[Tooltip("How much the bones slowed down.")]
	[Range(0f, 1f)]
	public float m_Damping = 0.1f;

	public AnimationCurve m_DampingDistrib = null;

	[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 = null;

	[Tooltip("How much bone's original orientation are preserved.")]
	[Range(0f, 1f)]
	public float m_Stiffness = 0.1f;

	public AnimationCurve m_StiffnessDistrib = null;

	[Tooltip("How much character's position change is ignored in physics simulation.")]
	[Range(0f, 1f)]
	public float m_Inert = 0f;

	public AnimationCurve m_InertDistrib = null;

	[Tooltip("How much the bones slowed down when collide.")]
	public float m_Friction = 0f;

	public AnimationCurve m_FrictionDistrib = null;

	[Tooltip("Each bone can be a sphere to collide with colliders. Radius describe sphere's size.")]
	public float m_Radius = 0f;

	public AnimationCurve m_RadiusDistrib = null;

	[Tooltip("If End Length is not zero, an extra bone is generated at the end of transform hierarchy.")]
	public float m_EndLength = 0f;

	[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 = null;

	[Tooltip("Bones exclude from physics simulation.")]
	public List<Transform> m_Exclusions = null;

	[Tooltip("Constrain bones to move on specified plane.")]
	public FreezeAxis m_FreezeAxis = FreezeAxis.None;

	[Tooltip("Disable physics simulation automatically if character is far from camera or player.")]
	public bool m_DistantDisable = false;

	public Transform m_ReferenceObject = null;

	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 = 0f;

	private float m_ObjectScale = 1f;

	private float m_Time = 0f;

	private float m_Weight = 1f;

	private bool m_DistantDisabled = false;

	private List<Particle> m_Particles = new List<Particle>();

	private void Start()
	{
		SetupParticles();
	}

	private void FixedUpdate()
	{
		if (m_UpdateMode == UpdateMode.AnimatePhysics)
		{
			PreUpdate();
		}
	}

	private void Update()
	{
		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.deltaTime : Time.unscaledDeltaTime);
			UpdateDynamicBones(t);
		}
	}

	private void PreUpdate()
	{
		if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled))
		{
			InitTransforms();
		}
	}

	private void CheckDistance()
	{
		//IL_003d: 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_0052: 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;
		float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
		bool flag = sqrMagnitude > m_DistanceToObject * m_DistanceToObject;
		if (flag != m_DistantDisabled)
		{
			if (!flag)
			{
				ResetParticlesPosition();
			}
			m_DistantDisabled = flag;
		}
	}

	private void OnEnable()
	{
		ResetParticlesPosition();
	}

	private void OnDisable()
	{
		InitTransforms();
	}

	private void OnValidate()
	{
		m_UpdateRate = Mathf.Max(m_UpdateRate, 0f);
		m_Damping = Mathf.Clamp01(m_Damping);
		m_Elasticity = Mathf.Clamp01(m_Elasticity);
		m_Stiffness = Mathf.Clamp01(m_Stiffness);
		m_Inert = Mathf.Clamp01(m_Inert);
		m_Friction = Mathf.Clamp01(m_Friction);
		m_Radius = Mathf.Max(m_Radius, 0f);
		if (Application.isEditor && Application.isPlaying)
		{
			InitTransforms();
			SetupParticles();
		}
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: 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)
		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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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)
		//IL_004c: 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_00ed: 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)
		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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		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_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		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++)
				{
					Transform val2 = m_Exclusions[j];
					if ((Object)(object)val2 == (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_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_0029: 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_002f: 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)
		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_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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_0075: 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_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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		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_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: 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_0046: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_011f: 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)
		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_0003: 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_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_0086: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: 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_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: 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_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: 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_02d4: 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_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		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];
			float magnitude;
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				Vector3 val2 = particle2.m_Transform.position - particle.m_Transform.position;
				magnitude = ((Vector3)(ref val2)).magnitude;
			}
			else
			{
				Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix;
				Vector3 val3 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyVector(particle.m_EndOffset);
				magnitude = ((Vector3)(ref val3)).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 val4 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition));
				Vector3 val5 = val4 - particle.m_Position;
				particle.m_Position += val5 * particle.m_Elasticity;
				if (num > 0f)
				{
					val5 = val4 - particle.m_Position;
					float magnitude2 = ((Vector3)(ref val5)).magnitude;
					float num2 = magnitude * (1f - num) * 2f;
					if (magnitude2 > num2)
					{
						particle.m_Position += val5 * ((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 val6 = particle2.m_Position - particle.m_Position;
			float magnitude3 = ((Vector3)(ref val6)).magnitude;
			if (magnitude3 > 0f)
			{
				particle.m_Position += val6 * ((magnitude3 - magnitude) / magnitude3);
			}
		}
	}

	private void SkipUpdateParticles()
	{
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0025: 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_003c: 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)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_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_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		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];
				float magnitude;
				if ((Object)(object)particle.m_Transform != (Object)null)
				{
					Vector3 val = particle2.m_Transform.position - particle.m_Transform.position;
					magnitude = ((Vector3)(ref val)).magnitude;
				}
				else
				{
					Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix;
					Vector3 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)
				{
					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;
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					float num2 = magnitude * (1f - num) * 2f;
					if (magnitude2 > num2)
					{
						particle.m_Position += val4 * ((magnitude2 - num2) / magnitude2);
					}
				}
				Vector3 val5 = particle2.m_Position - particle.m_Position;
				float magnitude3 = ((Vector3)(ref val5)).magnitude;
				if (magnitude3 > 0f)
				{
					particle.m_Position += val5 * ((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_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		return v - axis * (Vector3.Dot(v, axis) * 2f);
	}

	private void ApplyParticlesToTransforms()
	{
		//IL_00c1: 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_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_0064: 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_007c: 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_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_0091: 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)
		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 = 0f;

	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_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_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_004a: Unknown result type (might be due to invalid IL or missing references)
		float num = sphereRadius + particleRadius;
		float num2 = num * num;
		Vector3 val = particlePosition - sphereCenter;
		float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
		if (sqrMagnitude > 0f && sqrMagnitude < num2)
		{
			float num3 = Mathf.Sqrt(sqrMagnitude);
			particlePosition = sphereCenter + val * (num / num3);
			return true;
		}
		return false;
	}

	private static bool InsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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)
		//IL_003f: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		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_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//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_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_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		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_002b: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_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_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		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 = Bound.Outside;

	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_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_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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_002b: 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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		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);
		}
	}
}
internal class LuxTexturePostprocessor : AssetPostprocessor
{
	public const string SpecSuffix = "_LuxSPEC";

	public const string SpecShortSuffix = "LuxSPEC";

	public const string NormalSuffix = "_LuxNRM";

	public const string NormalShortSuffix = "LuxNRM";

	public void OnPostprocessTexture(Texture2D specMap)
	{
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Expected O, but got Unknown
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Expected O, but got Unknown
		if (!((AssetPostprocessor)this).assetPath.Contains("_LuxSPEC"))
		{
			return;
		}
		string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(((AssetPostprocessor)this).assetPath);
		string[] array = fileNameWithoutExtension.Split(new char[1] { '_' });
		string text = string.Empty;
		for (int i = 0; i < array.Length && !(array[i] == "LuxSPEC"); i++)
		{
			text = text + array[i] + '_';
		}
		text += "LuxNRM";
		string text2 = Path.Combine(Path.GetDirectoryName(((AssetPostprocessor)this).assetPath), Path.GetFileNameWithoutExtension(text));
		text2 += Path.GetExtension(((AssetPostprocessor)this).assetPath);
		if (File.Exists(text2))
		{
			TextureImporter val = (TextureImporter)AssetImporter.GetAtPath(text2);
			if (!val.isReadable)
			{
				Debug.Log((object)"Normal texture has to be reimported as readable. Please reimport the _SPEC texture as well.");
				val.isReadable = true;
				AssetDatabase.ImportAsset(text2, (ImportAssetOptions)1);
				return;
			}
			Debug.Log((object)("Filtering Texture: " + fileNameWithoutExtension));
			TextureImporter val2 = (TextureImporter)AssetImporter.GetAtPath(((AssetPostprocessor)this).assetPath);
			val2.isReadable = true;
			val2.filterMode = (FilterMode)2;
			Object obj = AssetDatabase.LoadAssetAtPath(text2, typeof(Texture2D));
			Texture2D bumpMap = (Texture2D)(object)((obj is Texture2D) ? obj : null);
			int width = ((Texture)specMap).width;
			int height = ((Texture)specMap).height;
			int mipmapCount = specMap.mipmapCount;
			for (int j = 1; j < mipmapCount; j++)
			{
				ProcessMipLevel(ref specMap, bumpMap, width, height, j);
			}
			specMap.Apply(false, false);
			bumpMap = null;
		}
		else
		{
			Debug.Log((object)("No corresponding normal map found at:" + text2));
			Debug.Log((object)(Path.GetFileNameWithoutExtension(text) + Path.GetExtension(((AssetPostprocessor)this).assetPath)));
		}
	}

	private static void ProcessMipLevel(ref Texture2D specMap, Texture2D bumpMap, int maxwidth, int maxheight, int mipLevel)
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: 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_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		Color32[] pixels = specMap.GetPixels32(mipLevel);
		Color32[] pixels2 = bumpMap.GetPixels32(0);
		int num = Mathf.Max(1, ((Texture)specMap).width >> mipLevel);
		int num2 = Mathf.Max(1, ((Texture)specMap).height >> mipLevel);
		int num3 = 0;
		int num4 = 1 << mipLevel;
		Vector3 val3 = default(Vector3);
		for (int i = 0; i < num2; i++)
		{
			for (int j = 0; j < num; j++)
			{
				float num5 = (float)j / (float)num;
				float num6 = (float)i / (float)num2;
				int num7 = Mathf.FloorToInt(num5 * (float)maxwidth);
				int num8 = Mathf.FloorToInt(num6 * (float)maxheight);
				Vector3 val = Vector3.zero;
				for (int k = 0; k < num4; k++)
				{
					for (int l = 0; l < num4; l++)
					{
						int num9 = num7 + l;
						int num10 = num8 + k;
						Color32 val2 = pixels2[num10 * maxheight + num9];
						((Vector3)(ref val3))..ctor((float)(int)val2.a / 255f * 2f - 1f, (float)(int)val2.g / 255f * 2f - 1f, 0f);
						val3.z = Mathf.Sqrt(1f - val3.x * val3.x - val3.y * val3.y);
						((Vector3)(ref val3)).Normalize();
						val += val3;
					}
				}
				val /= (float)(num4 * num4);
				Vector3 val4 = val;
				float magnitude = ((Vector3)(ref val4)).magnitude;
				float num11 = 10000f;
				if (magnitude < 1f)
				{
					num11 = (3f * magnitude - magnitude * magnitude * magnitude) / (1f - magnitude * magnitude);
				}
				float num12 = 1f - (float)(int)pixels[num3].a / 255f;
				pixels[num3].a = (byte)(Mathf.Clamp01(1f - Mathf.Sqrt(num12 * num12 + 1f / num11)) * 255f);
				num3++;
			}
		}
		specMap.SetPixels32(pixels, mipLevel);
	}
}
[AddComponentMenu("Lux/Area Light")]
[ExecuteInEditMode]
[RequireComponent(typeof(Light))]
public class LuxAreaLight : MonoBehaviour
{
	[Header("Area Light Properties")]
	[Range(0f, 40f)]
	public float lightLength = 1f;

	[Range(0.04f, 40f)]
	public float lightRadius = 0.5f;

	[Range(0f, 1f)]
	public float specularIntensity = 1f;

	[Header("Light Overwrites")]
	public Color lightColor = new Color(1f, 1f, 1f, 0f);

	[Range(0f, 8f)]
	public float lightIntensity = 1f;

	private Light lightSource;

	private float range;

	private void Update()
	{
		UpdateAreaLight();
	}

	private void OnValidate()
	{
		UpdateAreaLight();
	}

	private void OnEnable()
	{
		UpdateAreaLight();
	}

	private void OnDisable()
	{
		ResetAreaLight();
	}

	public void UpdateAreaLight()
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)lightSource == (Object)null)
		{
			lightSource = ((Component)this).GetComponent<Light>();
		}
		range = lightSource.range;
		if (range < lightLength * 0.75f)
		{
			range = lightLength * 0.75f;
			lightSource.range = range;
		}
		Color val = lightColor;
		val *= lightIntensity;
		float num = lightRadius / 80f;
		float num2 = lightLength / 80f;
		val.a = Mathf.Floor(num * 2047f) * 2048f + Mathf.Floor(num2 * 2047f) + specularIntensity * 0.5f;
		lightSource.intensity = 1f;
		lightSource.color = val;
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0007: 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_0048: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
		Gizmos.color = Color.red;
		if ((double)lightLength == 0.0)
		{
			Gizmos.DrawWireSphere(Vector3.zero, lightRadius);
		}
		else
		{
			Gizmos.DrawWireSphere(Vector3.zero - new Vector3(0f, lightLength * 0.5f, 0f), lightRadius);
			Gizmos.DrawWireSphere(Vector3.zero + new Vector3(0f, lightLength * 0.5f, 0f), lightRadius);
		}
		Gizmos.matrix = Matrix4x4.identity;
	}

	private void ResetAreaLight()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)lightSource == (Object)null)
		{
			lightSource = ((Component)this).GetComponent<Light>();
		}
		lightSource.color = new Color(lightColor.r, lightColor.g, lightColor.b, 1f);
		lightSource.intensity = lightIntensity;
	}
}
public class ReadOnlyRangeAttribute : PropertyAttribute
{
	public float min;

	public float max;

	public ReadOnlyRangeAttribute(float min, float max)
	{
		this.min = min;
		this.max = max;
	}
}
public class CustomLabelRangeAttribute : PropertyAttribute
{
	public float min;

	public float max;

	public string labeltext;

	public CustomLabelRangeAttribute(float min, float max, string labeltext)
	{
		this.min = min;
		this.max = max;
		this.labeltext = labeltext;
	}
}
[ExecuteInEditMode]
public class LuxDynamicWeather : MonoBehaviour
{
	[Header("Dynamic Weather")]
	[Space(4f)]
	public bool ScriptControlledWeather = true;

	[Space(10f)]
	[Range(0.1f, 4f)]
	public float TimeScale = 1f;

	[Tooltip("Next to 'Rainfall' 'Temperature' is the most important input as it decides whether it rains or snows.'")]
	[Range(-40f, 40f)]
	public float Temperature = 20f;

	[Tooltip("Controls rain and snow intensity according to the given temperature.")]
	[Range(0f, 1f)]
	public float Rainfall = 0f;

	[ReadOnlyRange(0f, 1f)]
	public float RainIntensity = 0f;

	[ReadOnlyRange(0f, 1f)]
	public float SnowIntensity = 0f;

	[Space(10f)]
	[Range(0f, 1f)]
	public float WetnessInfluenceOnAlbedo = 0.85f;

	[Range(0f, 1f)]
	public float WetnessInfluenceOnSmoothness = 0.5f;

	[Range(0f, 1f)]
	public float AccumulationRateWetness = 0.35f;

	[Range(0f, 0.5f)]
	public float EvaporationRateWetness = 0.075f;

	[Space(10f)]
	[Range(0f, 1f)]
	public float AccumulationRateCracks = 0.25f;

	[Range(0f, 1f)]
	public float AccumulationRatePuddles = 0.2f;

	[Range(0f, 0.5f)]
	public float EvaporationRateCracks = 0.2f;

	[Range(0f, 0.5f)]
	public float EvaporationRatePuddles = 0.1f;

	[Space(5f)]
	[Range(0f, 0.5f)]
	public float AccumulationRateSnow = 0.1f;

	[Space(15f)]
	[Range(0f, 1f)]
	public float AccumulatedWetness = 0f;

	[Range(0f, 1f)]
	public float AccumulatedCracks = 0f;

	[Range(0f, 1f)]
	public float AccumulatedPuddles = 0f;

	[ReadOnlyRange(0f, 1f)]
	public float AccumulatedWater = 0f;

	[Space(5f)]
	[Range(0f, 1f)]
	public float AccumulatedSnow = 0f;

	[Space(5f)]
	[Range(0f, 1f)]
	public float WaterToSnow = 0.01f;

	[Space(15f)]
	[Range(0.01f, 1f)]
	public float WaterToSnowTimeScale = 1f;

	public AnimationCurve WaterToSnowCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
	{
		new Keyframe(0f, 0.25f),
		new Keyframe(1f, 1f)
	});

	[ReadOnlyRange(0f, 1f)]
	public float SnowMelt = 0f;

	[Header("Snow")]
	[Space(4f)]
	[ColorUsage(false, true, 0f, 2f, 0.125f, 3f)]
	public Color SnowColor = Color.white;

	public Color SnowSpecularColor = new Color(0.2f, 0.2f, 0.2f, 1f);

	public Color SnowScatterColor;

	[Range(0f, 1f)]
	public float SnowDiffuseScatteringBias = 0f;

	[Range(1f, 10f)]
	public float SnowDiffuseScatteringContraction = 8f;

	[Space(5f)]
	[Tooltip("Mask in (G) Normal in (BA)")]
	public Texture2D SnowMask;

	[Tooltip("Snow and Water Bump in (GA) Snow Smoothness in (B)")]
	public Texture2D SnowAndWaterBump;

	[Range(-100f, 8000f)]
	public float SnowStartHeight = -100f;

	[Range(0f, 1f)]
	public float SnowHeightBlending = 0.01f;

	private float Lux_adjustedSnowAmount;

	[Header("World mapped Snow")]
	[Space(4f)]
	public float SnowTiling = 0.2f;

	public float SnowDetailTiling = 0.5f;

	public float SnowMaskTiling = 0.01f;

	public float SnowMaskDetailTiling = 0.37f;

	public float SnowNormalStregth = 1f;

	public float SnowNormalDetailStrength = 0.3f;

	[Space(10f)]
	public ParticleSystem SnowParticleSystem;

	public int MaxSnowParticlesEmissionRate = 3000;

	[Header("Rain")]
	[Space(4f)]
	public Texture2D RainRipples;

	public float RippleTiling = 4f;

	public float RippleAnimSpeed = 1f;

	[Range(0f, 1f)]
	public float RippleRefraction = 0.5f;

	public int RenderTextureSize = 512;

	public RenderTexture RainRipplesRenderTexture;

	private Material m_material;

	[Space(10f)]
	public ParticleSystem RainParticleSystem;

	public int MaxRainParticlesEmissionRate = 3000;

	private int RainSnowIntensityPID;

	private int WaterFloodLevelPID;

	private int RainRipplesPID;

	private int RippleAnimSpeedPID;

	private int RippleTilingPID;

	private int RippleRefractionPID;

	private int SnowHeightParamsPID;

	private int WaterToSnowPID;

	private int SnowMeltPID;

	private int SnowAmountPID;

	private int SnowColorPID;

	private int SnowSpecColorPID;

	private int SnowScatterColorPID;

	private int SnowScatteringBiasPID;

	private int SnowSnowScatteringContractionPID;

	private int WorldMappedSnowTilingPID;

	private int WorldMappedSnowStrengthPID;

	private int SnowMaskPID;

	private int SnowWaterBumpPID;

	[Header("GI")]
	[Space(4f)]
	[Tooltip("When using dynamic GI you may attach one renderer per GI System in order to make GI being synced automatically to the given amount of snow.")]
	public Renderer[] SnowGIMasterRenderers;

	private void OnEnable()
	{
		SetupRippleRT();
	}

	private void SetupRippleRT()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		if ((Object)(object)RainRipplesRenderTexture == (Object)null || (Object)(object)m_material == (Object)null)
		{
			RainRipplesRenderTexture = new RenderTexture(RenderTextureSize, RenderTextureSize, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)1);
			RainRipplesRenderTexture.useMipMap = true;
			((Texture)RainRipplesRenderTexture).wrapMode = (TextureWrapMode)0;
			m_material = new Material(Shader.Find("Hidden/Lux RainRipplesComposite"));
			GetPIDs();
		}
	}

	private void GetPIDs()
	{
		RainSnowIntensityPID = Shader.PropertyToID("_Lux_RainfallRainSnowIntensity");
		WaterFloodLevelPID = Shader.PropertyToID("_Lux_WaterFloodlevel");
		RainRipplesPID = Shader.PropertyToID("_Lux_RainRipples");
		RippleAnimSpeedPID = Shader.PropertyToID("_Lux_RippleAnimSpeed");
		RippleTilingPID = Shader.PropertyToID("_Lux_RippleTiling");
		RippleRefractionPID = Shader.PropertyToID("_Lux_RippleRefraction");
		SnowHeightParamsPID = Shader.PropertyToID("_Lux_SnowHeightParams");
		WaterToSnowPID = Shader.PropertyToID("_Lux_WaterToSnow");
		SnowMeltPID = Shader.PropertyToID("_Lux_SnowMelt");
		SnowAmountPID = Shader.PropertyToID("_Lux_SnowAmount");
		SnowColorPID = Shader.PropertyToID("_Lux_SnowColor");
		SnowSpecColorPID = Shader.PropertyToID("_Lux_SnowSpecColor");
		SnowScatterColorPID = Shader.PropertyToID("_Lux_SnowScatterColor");
		SnowScatteringBiasPID = Shader.PropertyToID("_Lux_SnowScatteringBias");
		SnowSnowScatteringContractionPID = Shader.PropertyToID("_Lux_SnowScatteringContraction");
		WorldMappedSnowTilingPID = Shader.PropertyToID("_Lux_WorldMappedSnowTiling");
		WorldMappedSnowStrengthPID = Shader.PropertyToID("_Lux_WorldMappedSnowStrength");
		SnowMaskPID = Shader.PropertyToID("_Lux_SnowMask");
		SnowWaterBumpPID = Shader.PropertyToID("_Lux_SnowWaterBump");
	}

	private void Start()
	{
	}

	private void Update()
	{
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0498: Unknown result type (might be due to invalid IL or missing references)
		//IL_053c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0565: Unknown result type (might be due to invalid IL or missing references)
		//IL_0576: Unknown result type (might be due to invalid IL or missing references)
		//IL_0587: Unknown result type (might be due to invalid IL or missing references)
		//IL_058c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
		if (ScriptControlledWeather)
		{
			float num = Mathf.Lerp(0f, EvaporationRateWetness, Temperature / 40f);
			float num2 = Mathf.Lerp(0f, EvaporationRateCracks, Temperature / 40f);
			float num3 = Mathf.Lerp(0f, EvaporationRatePuddles, Mathf.Abs(Temperature) / 40f);
			float num4 = Mathf.Abs(Temperature);
			num4 = Mathf.Lerp(0f, 1f, num4 / 40f);
			if (Temperature > 0f)
			{
				WaterToSnow -= num4 * Time.deltaTime * TimeScale * WaterToSnowTimeScale;
				WaterToSnow = Mathf.Clamp01(WaterToSnow);
				float num5 = Mathf.Clamp01((1f - WaterToSnow) * AccumulatedSnow * Time.deltaTime * TimeScale * WaterToSnowTimeScale * 4f);
				float num6 = RainIntensity * Time.deltaTime * TimeScale;
				AccumulatedWetness += num6 * AccumulationRateWetness + num5;
				AccumulatedCracks += num6 * AccumulationRateCracks;
				AccumulatedPuddles += num6 * AccumulationRatePuddles;
				if (Rainfall == 0f)
				{
					AccumulatedWetness -= num * Time.deltaTime * TimeScale;
					AccumulatedCracks -= num2 * Time.deltaTime * TimeScale;
					AccumulatedPuddles -= num3 * Time.deltaTime * TimeScale;
				}
				AccumulatedSnow -= num5;
			}
			else
			{
				WaterToSnow += num4 * Time.deltaTime * TimeScale * WaterToSnowTimeScale;
				WaterToSnow = Mathf.Clamp01(WaterToSnow);
				AccumulatedSnow += SnowIntensity * AccumulationRateSnow * Time.deltaTime * TimeScale + WaterToSnow * Mathf.Clamp01(AccumulatedWater) * Time.deltaTime * TimeScale * WaterToSnowTimeScale;
				AccumulatedWetness -= WaterToSnow * Time.deltaTime * TimeScale * WaterToSnowTimeScale;
				AccumulatedCracks -= WaterToSnow * Time.deltaTime * TimeScale * WaterToSnowTimeScale;
				AccumulatedPuddles -= WaterToSnow * Time.deltaTime * TimeScale * WaterToSnowTimeScale;
			}
			AccumulatedSnow = Mathf.Clamp01(AccumulatedSnow);
			AccumulatedWetness = Mathf.Clamp01(AccumulatedWetness);
			AccumulatedCracks = Mathf.Clamp01(AccumulatedCracks);
			AccumulatedPuddles = Mathf.Clamp01(AccumulatedPuddles);
			AccumulatedWater = Mathf.Max(AccumulatedCracks, AccumulatedPuddles);
			SnowMelt = 1f - WaterToSnow;
			SnowIntensity = Rainfall * WaterToSnow;
			RainIntensity = Rainfall - SnowIntensity;
		}
		else
		{
			SnowIntensity = Rainfall;
			RainIntensity = Rainfall;
		}
		float num7 = WaterToSnowCurve.Evaluate(WaterToSnow);
		WaterToSnow = Mathf.Clamp(WaterToSnow, 0f, 1f);
		Shader.SetGlobalVector(WaterToSnowPID, new Vector4(WaterToSnow, 1f - Mathf.Pow(2f, -10f * WaterToSnow), 0f, 0f));
		Shader.SetGlobalVector(SnowMeltPID, new Vector4(1f - num7, 1f - Mathf.Pow(2f, -10f * (1f - num7)), 0f, 0f));
		Shader.SetGlobalVector(RainSnowIntensityPID, Vector4.op_Implicit(new Vector3(Rainfall, RainIntensity, SnowIntensity)));
		Shader.SetGlobalVector(WaterFloodLevelPID, new Vector4(AccumulatedCracks, AccumulatedPuddles, AccumulatedWetness * WetnessInfluenceOnAlbedo * (1f - WaterToSnow), AccumulatedWetness * WetnessInfluenceOnSmoothness * (1f - WaterToSnow)));
		Shader.SetGlobalTexture(SnowMaskPID, (Texture)(object)SnowMask);
		Shader.SetGlobalTexture(SnowWaterBumpPID, (Texture)(object)SnowAndWaterBump);
		if (Object.op_Implicit((Object)(object)RainRipples))
		{
			Shader.SetGlobalTexture(RainRipplesPID, (Texture)(object)RainRipples);
		}
		Shader.SetGlobalFloat(RippleAnimSpeedPID, RippleAnimSpeed);
		Shader.SetGlobalFloat(RippleTilingPID, RippleTiling);
		Shader.SetGlobalFloat(RippleRefractionPID, RippleRefraction);
		Shader.SetGlobalVector(SnowHeightParamsPID, new Vector4(SnowStartHeight, SnowHeightBlending * 1000f, 0f, 0f));
		Shader.SetGlobalFloat(SnowAmountPID, AccumulatedSnow * WaterToSnow);
		Shader.SetGlobalColor(SnowColorPID, SnowColor);
		Shader.SetGlobalColor(SnowSpecColorPID, SnowSpecularColor);
		Shader.SetGlobalVector(SnowScatterColorPID, Color.op_Implicit(SnowScatterColor));
		Shader.SetGlobalFloat(SnowScatteringBiasPID, SnowDiffuseScatteringBias);
		Shader.SetGlobalFloat(SnowSnowScatteringContractionPID, SnowDiffuseScatteringContraction);
		Shader.SetGlobalVector(WorldMappedSnowTilingPID, new Vector4(SnowTiling, SnowDetailTiling, SnowMaskTiling, SnowMaskDetailTiling));
		Shader.SetGlobalVector(WorldMappedSnowStrengthPID, Vector4.op_Implicit(new Vector2(SnowNormalStregth, SnowNormalDetailStrength)));
		if (SnowGIMasterRenderers != null && SnowGIMasterRenderers.Length > 0)
		{
			for (int i = 0; i < SnowGIMasterRenderers.Length; i++)
			{
				if ((Object)(object)SnowGIMasterRenderers[i] != (Object)null)
				{
					RendererExtensions.UpdateGIMaterials(SnowGIMasterRenderers[i]);
				}
			}
		}
		if ((Object)(object)SnowParticleSystem != (Object)null)
		{
			EmissionModule emission = SnowParticleSystem.emission;
			((EmissionModule)(ref emission)).rateOverTimeMultiplier = (float)MaxSnowParticlesEmissionRate * SnowIntensity;
		}
		if ((Object)(object)RainParticleSystem != (Object)null)
		{
			EmissionModule emission2 = RainParticleSystem.emission;
			((EmissionModule)(ref emission2)).rateOverTimeMultiplier = (float)MaxRainParticlesEmissionRate * RainIntensity;
		}
		if (Object.op_Implicit((Object)(object)RainRipples))
		{
			GL.sRGBWrite = true;
			m_material.SetFloat(RainSnowIntensityPID, RainIntensity);
			m_material.SetFloat(RippleAnimSpeedPID, RippleAnimSpeed);
			Graphics.Blit((Texture)(object)RainRipples, RainRipplesRenderTexture, m_material);
			RainRipplesRenderTexture.SetGlobalShaderProperty("_Lux_RainRipplesRT");
		}
	}
}
[ExecuteInEditMode]
public class LuxSetup : MonoBehaviour
{
	[Header("Detail Distance")]
	[Space(2f)]
	[Range(10f, 100f)]
	public float DetailDistance = 50f;

	[Range(1f, 25f)]
	public float DetailFadeRange = 15f;

	[Header("Area Lights")]
	[Space(2f)]
	public bool enableAreaLights = false;

	[Header("Translucent Lighting")]
	[Space(2f)]
	[Tooltip("Distort translucent lighting by surface normals.")]
	[CustomLabelRange(0f, 1f, "Distortion")]
	public float BumpDistortion_T = 0.1f;

	[CustomLabelRange(1f, 8f, "Scale")]
	public float Scale_T = 4f;

	[CustomLabelRange(0f, 1f, "Shadow Strength")]
	public float ShadowStrength_T = 0.7f;

	[CustomLabelRange(0f, 1f, "Shadow Strength NdotL")]
	public float ShadowStrength_NdotL = 0.7f;

	[Header("Skin Lighting")]
	[Space(2f)]
	public Texture BRDFTexture;

	[Space(5f)]
	public Color SubsurfaceColor = new Color(1f, 0.4f, 0.25f, 1f);

	[CustomLabelRange(1f, 8f, "Power")]
	public float Power_S = 2f;

	[CustomLabelRange(0f, 1f, "Distortion")]
	public float Distortion_S = 0.1f;

	[CustomLabelRange(0f, 8f, "Scale")]
	public float Scale_S = 2f;

	[Space(5f)]
	public bool EnableSkinLightingFade = false;

	[Range(0f, 50f)]
	public float SkinLightingDistance = 20f;

	[Range(0f, 20f)]
	public float SkinLightingFadeRange = 8f;

	[Header("Anisotropic Lighting")]
	[Space(2f)]
	[Tooltip("Distort translucent lighting by surface normals.")]
	[CustomLabelRange(1f, 8f, "Power")]
	public float Power_A = 2f;

	[CustomLabelRange(0f, 1f, "Distortion")]
	public float BumpDistortion_A = 0.1f;

	[CustomLabelRange(1f, 8f, "Scale")]
	public float Scale_A = 4f;

	[CustomLabelRange(0f, 1f, "Shadow Strength")]
	public float ShadowStrength_A = 0.7f;

	private void UpdateLuxGlobalShaderVariables()
	{
		//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_008c: 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_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_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		Shader.SetGlobalVector("_Lux_DetailDistanceFade", Vector4.op_Implicit(new Vector2(DetailDistance, DetailFadeRange)));
		if (enableAreaLights)
		{
			Shader.EnableKeyword("LUX_AREALIGHTS");
		}
		else
		{
			Shader.DisableKeyword("LUX_AREALIGHTS");
		}
		if ((Object)(object)BRDFTexture == (Object)null)
		{
			ref Texture bRDFTexture = ref BRDFTexture;
			Object obj = Resources.Load("DiffuseScatteringOnRing");
			bRDFTexture = (Texture)(object)((obj is Texture) ? obj : null);
		}
		Shader.SetGlobalTexture("_BRDFTex", BRDFTexture);
		Shader.SetGlobalColor("_SubColor", ((Color)(ref SubsurfaceColor)).linear);
		Shader.SetGlobalVector("_Lux_Skin_DeepSubsurface", new Vector4(Power_S, Distortion_S, Scale_S, 0f));
		if (EnableSkinLightingFade)
		{
			Shader.EnableKeyword("LUX_LIGHTINGFADE");
		}
		else
		{
			Shader.DisableKeyword("LUX_LIGHTINGFADE");
		}
		Shader.SetGlobalVector("_Lux_Skin_DistanceRange", Vector4.op_Implicit(new Vector2(SkinLightingDistance, SkinLightingFadeRange)));
		Shader.SetGlobalVector("_Lux_Tanslucent_Settings", new Vector4(BumpDistortion_T, 0f, 1f - ShadowStrength_T, Scale_T));
		Shader.SetGlobalFloat("_Lux_Translucent_NdotL_Shadowstrength", 1f - ShadowStrength_NdotL);
		Shader.SetGlobalVector("_Lux_Anisotropic_Settings", new Vector4(BumpDistortion_A, Power_A, 1f - ShadowStrength_A, Scale_A));
	}

	private void Start()
	{
		UpdateLuxGlobalShaderVariables();
	}

	private void OnValidate()
	{
		UpdateLuxGlobalShaderVariables();
	}

	private void Update()
	{
		Shader.SetGlobalFloat("_Lux_ShadowDistance", QualitySettings.shadowDistance);
	}
}
namespace Niko666
{
	public class AK117LavaAnimController : MonoBehaviour
	{
		public ClosedBoltWeapon Weapon;

		public Animator Animator;

		public AudioSource AudioSource;

		public GameObject Magazine;

		public string Fire_Node = "Fire";

		public string Reload_P1_Node = "Reload_P1";

		public string Reload_P2_Node = "Reload_P2";

		public string Reload_Close_Node = "Reload_Close";

		public string Reload_Empty_P1_Node = "Reload_Empty_P1";

		public string Reload_Empty_P2_Node = "Reload_Empty_P2";

		public AudioClip Reload_P1_Clip;

		public AudioClip Reload_P2_Clip;

		public AudioClip Reload_Close_Clip;

		public AudioClip Reload_Empty_P1_Clip;

		public AudioClip Reload_Empty_P2_Clip;

		private Vector2 dir2 = Vector2.down;

		private bool _hasPlayedFire = true;

		private bool _hasPlayedReloadP1 = false;

		private bool _hasPlayedReloadP2 = true;

		private bool _hasPlayedReloadEmptyP1 = false;

		private bool _hasPlayedReloadEmptyP2 = false;

		public void Awake()
		{
			Animator.cullingMode = (AnimatorCullingMode)0;
		}

		public void Update()
		{
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null))
			{
				return;
			}
			if (Weapon.m_fireSelectorMode == 0)
			{
				((FVRFireArm)Weapon).UsesClips = false;
				return;
			}
			if (!Weapon.Chamber.IsFull && !_hasPlayedFire && ((FVRFireArm)Weapon).Magazine.HasARound())
			{
				Animator.Play(Fire_Node);
				_hasPlayedFire = true;
			}
			else if (Weapon.Chamber.IsFull)
			{
				_hasPlayedFire = false;
			}
			if (!((FVRFireArm)Weapon).Magazine.HasARound() && !Weapon.Chamber.IsFull && !_hasPlayedReloadEmptyP1)
			{
				((FVRFireArm)Weapon).UsesClips = true;
				Magazine.SetActive(false);
				_hasPlayedReloadEmptyP2 = false;
				Animator.Play(Reload_Empty_P1_Node);
				AudioSource.PlayOneShot(Reload_Empty_P1_Clip, 0.15f);
				_hasPlayedReloadEmptyP1 = true;
			}
			else if (((FVRFireArm)Weapon).Magazine.HasARound() && !_hasPlayedReloadEmptyP2)
			{
				((FVRFireArm)Weapon).UsesClips = false;
				Magazine.SetActive(true);
				_hasPlayedReloadEmptyP1 = false;
				Animator.Play(Reload_Empty_P2_Node);
				AudioSource.PlayOneShot(Reload_Empty_P2_Clip, 0.15f);
				Weapon.Bolt.ImpartFiringImpulse();
				_hasPlayedReloadEmptyP2 = true;
			}
			if (((FVRFireArm)Weapon).Magazine.HasARound() && Weapon.Chamber.IsFull && ((!((FVRInteractiveObject)Weapon).m_hand.IsInStreamlinedMode && Vector2.Angle(((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadAxes, dir2) <= 45f && ((Vector2)(ref ((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadAxes)).magnitude > 0.4f && ((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadPressed) || (((FVRInteractiveObject)Weapon).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)Weapon).m_hand.Input.AXButtonDown)))
			{
				if (!_hasPlayedReloadP1 && _hasPlayedReloadP2 && !AudioSource.isPlaying && !((FVRFireArm)Weapon).Magazine.IsFull())
				{
					((FVRFireArm)Weapon).UsesClips = true;
					Magazine.SetActive(false);
					_hasPlayedReloadP2 = false;
					Animator.Play(Reload_P1_Node);
					AudioSource.PlayOneShot(Reload_P1_Clip, 0.15f);
					_hasPlayedReloadP1 = true;
				}
				else if (_hasPlayedReloadP1 && !_hasPlayedReloadP2 && !AudioSource.isPlaying)
				{
					((FVRFireArm)Weapon).UsesClips = false;
					Magazine.SetActive(false);
					Animator.Play(Reload_Close_Node);
					AudioSource.PlayOneShot(Reload_Close_Clip, 0.15f);
					_hasPlayedReloadP1 = false;
					_hasPlayedReloadP2 = true;
				}
			}
			else if (!_hasPlayedReloadP2 && _hasPlayedReloadP1 && ((FVRFireArm)Weapon).Magazine.IsFull())
			{
				((FVRFireArm)Weapon).UsesClips = false;
				Magazine.SetActive(true);
				_hasPlayedReloadP1 = false;
				Animator.Play(Reload_P2_Node);
				AudioSource.PlayOneShot(Reload_P2_Clip, 0.15f);
				_hasPlayedReloadP2 = true;
			}
		}
	}
	public class AN94BurstSystem : MonoBehaviour
	{
		public ClosedBoltWeapon Weapon;

		public int BurstAmount = 4;

		private int _shotsSoFar = 0;

		private bool wasLoaded;

		public float DefForwardSpeed;

		public float DefRearwardSpeed;

		public float DefStiffness;

		public float FastForwardSpeed;

		public float FastRearwardSpeed;

		public float FastStiffness;

		public void FixedUpdate()
		{
			if (!((Object)(object)Weapon != (Object)null) || !((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null))
			{
				return;
			}
			if (wasLoaded && !Weapon.Chamber.IsFull)
			{
				_shotsSoFar++;
			}
			wasLoaded = Weapon.Chamber.IsFull;
			if (Weapon.m_triggerFloat <= Weapon.TriggerResetThreshold)
			{
				_shotsSoFar = 0;
				Weapon.Bolt.Speed_Forward = FastForwardSpeed;
				Weapon.Bolt.Speed_Rearward = FastRearwardSpeed;
				Weapon.Bolt.SpringStiffness = FastStiffness;
				return;
			}
			if (_shotsSoFar >= BurstAmount)
			{
				Weapon.Bolt.Speed_Forward = DefForwardSpeed;
				Weapon.Bolt.Speed_Rearward = DefRearwardSpeed;
				Weapon.Bolt.SpringStiffness = DefStiffness;
			}
			if (Weapon.m_triggerFloat <= Weapon.TriggerResetThreshold)
			{
				_shotsSoFar = 0;
			}
		}
	}
	public class ARX51BarrelSystem : MonoBehaviour
	{
		public ClosedBoltWeapon Weapon;

		public GameObject SpinningBarrels;

		public AudioSource SpinnySounds;

		public float SpinRate;

		public ? DirectionOfSpin;

		public float DecelerationRate = 0.5f;

		private float currentSpinSpeed = 0f;

		private bool TriggerPulled = false;

		public int BurstAmount = 4;

		private int _shotsSoFar = 0;

		private bool wasLoaded;

		public float DefForwardSpeed;

		public float DefRearwardSpeed;

		public float DefStiffness;

		public float FastForwardSpeed;

		public float FastRearwardSpeed;

		public float FastStiffness;

		public void FixedUpdate()
		{
			//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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected I4, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Weapon != (Object)null) || !((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null))
			{
				return;
			}
			float triggerFloat = Weapon.m_triggerFloat;
			if (triggerFloat >= Weapon.TriggerResetThreshold && Weapon.Chamber.IsFull)
			{
				if (!TriggerPulled)
				{
					TriggerPulled = true;
				}
				currentSpinSpeed = SpinRate;
				SpinnySounds.Play();
			}
			else if (TriggerPulled)
			{
				TriggerPulled = false;
			}
			if (!TriggerPulled && currentSpinSpeed > 0f)
			{
				currentSpinSpeed -= DecelerationRate * Time.deltaTime;
				if (currentSpinSpeed < 0f)
				{
					currentSpinSpeed = 0f;
				}
			}
			if (currentSpinSpeed > 0f && (Object)(object)SpinningBarrels != (Object)null)
			{
				Vector3 zero = Vector3.zero;
				int num = (int)DirectionOfSpin;
				if (num >= 0 && num <= 2)
				{
					((Vector3)(ref zero))[num] = currentSpinSpeed * Time.deltaTime;
					SpinningBarrels.transform.Rotate(zero);
				}
				else
				{
					Debug.LogWarning((object)"Invalid DirectionOfSpin value!");
				}
			}
			if (wasLoaded && !Weapon.Chamber.IsFull)
			{
				_shotsSoFar++;
			}
			wasLoaded = Weapon.Chamber.IsFull;
			if (Weapon.m_triggerFloat <= Weapon.TriggerResetThreshold)