Decompiled source of ModularHK417 and NightVision p2 v3.0.1

ModularHK417_and_NightVision_p2.dll

Decompiled 9 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;

[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]
[RequireComponent(typeof(Camera))]
public class DeferredNightVisionEffect : MonoBehaviour
{
	[SerializeField]
	[Tooltip("The main color of the NV effect")]
	public Color m_NVColor = new Color(0f, 1f, 0.1724138f, 0f);

	[SerializeField]
	[Tooltip("The color that the NV effect will 'bleach' towards (white = default)")]
	public Color m_TargetBleachColor = new Color(1f, 1f, 1f, 0f);

	[Range(0f, 0.1f)]
	[Tooltip("How much base lighting does the NV effect pick up")]
	public float m_baseLightingContribution = 0.025f;

	[Range(0f, 128f)]
	[Tooltip("The higher this value, the more bright areas will get 'bleached out'")]
	public float m_LightSensitivityMultiplier = 100f;

	private Material m_Material;

	private Shader m_Shader;

	[Tooltip("Do we want to apply a vignette to the edges of the screen?")]
	public bool useVignetting = true;

	public Shader NightVisionShader => m_Shader;

	private void DestroyMaterial(Material mat)
	{
		if (Object.op_Implicit((Object)(object)mat))
		{
			Object.DestroyImmediate((Object)(object)mat);
			mat = null;
		}
	}

	private void CreateMaterials()
	{
		if ((Object)(object)m_Shader == (Object)null)
		{
			m_Shader = Shader.Find("Custom/DeferredNightVisionShader");
		}
		if ((Object)(object)m_Material == (Object)null && (Object)(object)m_Shader != (Object)null && m_Shader.isSupported)
		{
			m_Material = CreateMaterial(m_Shader);
		}
	}

	private Material CreateMaterial(Shader shader)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)shader))
		{
			return null;
		}
		Material val = new Material(shader);
		((Object)val).hideFlags = (HideFlags)61;
		return val;
	}

	private void OnDisable()
	{
		DestroyMaterial(m_Material);
		m_Material = null;
		m_Shader = null;
	}

	[ContextMenu("UpdateShaderValues")]
	public void UpdateShaderValues()
	{
		//IL_0023: 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_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)
		if (!((Object)(object)m_Material == (Object)null))
		{
			m_Material.SetVector("_NVColor", Color.op_Implicit(m_NVColor));
			m_Material.SetVector("_TargetWhiteColor", Color.op_Implicit(m_TargetBleachColor));
			m_Material.SetFloat("_BaseLightingContribution", m_baseLightingContribution);
			m_Material.SetFloat("_LightSensitivityMultiplier", m_LightSensitivityMultiplier);
			m_Material.shaderKeywords = null;
			if (useVignetting)
			{
				Shader.EnableKeyword("USE_VIGNETTE");
			}
			else
			{
				Shader.DisableKeyword("USE_VIGNETTE");
			}
		}
	}

	private void OnEnable()
	{
		CreateMaterials();
		UpdateShaderValues();
	}

	public void ReloadShaders()
	{
		OnDisable();
	}

	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		UpdateShaderValues();
		CreateMaterials();
		Graphics.Blit((Texture)(object)source, destination, m_Material);
	}
}
public class ActivateGoggles : MonoBehaviour
{
	public Renderer[] HotObjects;

	public LayerMask Cold;

	public LayerMask Hot;

	public GameObject PostProcessObject;

	[SerializeField]
	[FormerlySerializedAs("Material")]
	private Material _material;

	private Material SkyboxMaterial;

	private Dictionary<Renderer, Material> HotObjectMaterialCache;

	private bool enabled = false;

	private void Start()
	{
		HotObjectMaterialCache = new Dictionary<Renderer, Material>();
		((MonoBehaviour)this).StartCoroutine(WaitForActivation());
	}

	private IEnumerator WaitForActivation()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => Input.GetKeyDown((KeyCode)49) && !enabled));
		PostProcessObject.SetActive(true);
		IEnumerable<Renderer> renderers = Object.FindObjectsOfType<Renderer>().ToList().Except(HotObjects);
		foreach (Renderer item in renderers)
		{
			((Component)item).gameObject.layer = 10;
		}
		_material.SetColor("_MainColor", Color.white);
		Renderer[] hotObjects = HotObjects;
		foreach (Renderer val in hotObjects)
		{
			HotObjectMaterialCache.Add(val, val.material);
			((Component)val).gameObject.layer = 9;
			val.material = _material;
		}
		SkyboxMaterial = RenderSettings.skybox;
		RenderSettings.skybox = null;
		enabled = true;
		yield return WaitForDeactivation();
	}

	private IEnumerator WaitForDeactivation()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => Input.GetKeyDown((KeyCode)50) && enabled));
		PostProcessObject.SetActive(false);
		IEnumerable<Renderer> renderers = Object.FindObjectsOfType<Renderer>().ToList().Except(HotObjects);
		foreach (Renderer item in renderers)
		{
			((Component)item).gameObject.layer = 0;
		}
		_material.SetColor("_MainColor", Color.white);
		Renderer[] hotObjects = HotObjects;
		foreach (Renderer val in hotObjects)
		{
			((Component)val).gameObject.layer = 0;
			val.material = HotObjectMaterialCache[val];
		}
		HotObjectMaterialCache.Clear();
		enabled = false;
		RenderSettings.skybox = SkyboxMaterial;
		yield return WaitForActivation();
	}
}
public class HeatController : MonoBehaviour
{
	public IEnumerator DecreaseHeat()
	{
		float slide = 0f;
		while (slide < 1f)
		{
			slide += Time.deltaTime * 0.1f;
			Material[] materials = ((Renderer)((Component)this).GetComponent<SkinnedMeshRenderer>()).materials;
			materials[0].SetColor("_MainColor", Color.Lerp(Color.white, Color.black, slide));
			((Renderer)((Component)this).GetComponent<SkinnedMeshRenderer>()).materials = materials;
			yield return null;
		}
	}
}
public class KillTheGuyAnimatorTrigger : MonoBehaviour
{
	private Animator animator;

	private HeatController[] _heatControllers;

	private void Awake()
	{
		animator = ((Component)this).GetComponent<Animator>();
		_heatControllers = Object.FindObjectsOfType<HeatController>();
		((MonoBehaviour)this).StartCoroutine(WaitForPress());
	}

	private IEnumerator WaitForPress()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => Input.GetKeyDown((KeyCode)112)));
		animator.SetTrigger("Kill");
		yield return (object)new WaitForSeconds(2f);
		ActivateAllHeatDowngrades();
	}

	private void ActivateAllHeatDowngrades()
	{
		HeatController[] heatControllers = _heatControllers;
		foreach (HeatController heatController in heatControllers)
		{
			((MonoBehaviour)this).StartCoroutine(heatController.DecreaseHeat());
		}
	}
}
public class ThermalVisionPlayerEventReceiver : MonoBehaviour
{
	private Material m_Material;

	private void Start()
	{
		m_Material = ((Component)this).GetComponent<Renderer>().material;
	}

	private void OnEnable()
	{
		ThermalVision.onThermalVisionEnabled += OnThermalModeInit;
		HeatVision.onHeatVisionEnabled += OnThermalMode2Init;
	}

	private void OnDisable()
	{
		ThermalVision.onThermalVisionEnabled -= OnThermalModeInit;
		HeatVision.onHeatVisionEnabled -= OnThermalMode2Init;
	}

	private void OnThermalModeInit(bool enabled)
	{
		//IL_0039: 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_001d: Unknown result type (might be due to invalid IL or missing references)
		if (enabled)
		{
			m_Material.SetColor("_EmissionColor", Color.white * 5f);
		}
		else
		{
			m_Material.SetColor("_EmissionColor", Color.black);
		}
	}

	private void OnThermalMode2Init(bool enabled)
	{
		//IL_0039: 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_001d: Unknown result type (might be due to invalid IL or missing references)
		if (enabled)
		{
			m_Material.SetColor("_EmissionColor", Color.white * 5f);
		}
		else
		{
			m_Material.SetColor("_EmissionColor", Color.black);
		}
	}
}
public class RangeFinder : MonoBehaviour
{
	private Text _text;

	private Camera _mainCam;

	private void Start()
	{
		_text = ((Component)this).GetComponent<Text>();
		_mainCam = Camera.main;
	}

	private void Update()
	{
		//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)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		Ray val = _mainCam.ScreenPointToRay(new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f, 0f));
		RaycastHit val2 = default(RaycastHit);
		if (Physics.Raycast(val, ref val2, 250f) && Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider))
		{
			_text.text = $"RNG {Mathf.Abs(((RaycastHit)(ref val2)).point.z)}";
		}
		else
		{
			_text.text = string.Format("RNG {0}", "-");
		}
	}
}
public class UIController : MonoBehaviour
{
	public GameObject panelNightVision;

	public GameObject panelThermalVision;

	public GameObject panelHeatVision;

	private void OnEnable()
	{
		Nightvision.onNightVisionEnabled += onNightVisionEnabled;
		HeatVision.onHeatVisionEnabled += onHeatVisionEnabled;
		ThermalVision.onThermalVisionEnabled += onThermalVisionEnabled;
	}

	private void OnDisable()
	{
		Nightvision.onNightVisionEnabled -= onNightVisionEnabled;
		HeatVision.onHeatVisionEnabled -= onHeatVisionEnabled;
		ThermalVision.onThermalVisionEnabled -= onThermalVisionEnabled;
	}

	private void onNightVisionEnabled(bool enabled)
	{
		if (Object.op_Implicit((Object)(object)panelNightVision))
		{
			panelNightVision.SetActive(enabled);
		}
	}

	private void onHeatVisionEnabled(bool enabled)
	{
		if (Object.op_Implicit((Object)(object)panelHeatVision))
		{
			panelHeatVision.SetActive(enabled);
		}
	}

	private void onThermalVisionEnabled(bool enabled)
	{
		if (Object.op_Implicit((Object)(object)panelThermalVision))
		{
			panelThermalVision.SetActive(enabled);
		}
	}
}
public class VisionController : MonoBehaviour
{
	private Nightvision nightVision;

	private HeatVision heatVision;

	private ThermalVision thermalVision;

	private float zoom;

	private void Start()
	{
		nightVision = Object.FindObjectOfType<Nightvision>();
		heatVision = Object.FindObjectOfType<HeatVision>();
		thermalVision = Object.FindObjectOfType<ThermalVision>();
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)110))
		{
			((Behaviour)nightVision).enabled = !((Behaviour)nightVision).enabled;
		}
		if (Input.GetKeyDown((KeyCode)104))
		{
			((Behaviour)heatVision).enabled = !((Behaviour)heatVision).enabled;
		}
		if (Input.GetKeyDown((KeyCode)116))
		{
			((Behaviour)thermalVision).enabled = !((Behaviour)thermalVision).enabled;
		}
		if (((Behaviour)nightVision).enabled)
		{
			zoom = Mathf.Clamp(zoom + Input.GetAxis("Mouse ScrollWheel"), 0f, 8f);
			nightVision._Zoom = zoom;
		}
	}
}
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Vision/NightVision")]
public class Nightvision : MonoBehaviour
{
	public delegate void OnNightVisionEnabledDelegate(bool enabled);

	public Shader shader;

	public Texture2D _NoiseTex;

	public Texture2D _MaskTex;

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

	[Range(2f, 20f)]
	public float _ColorAmplification = 6f;

	[Range(0.1f, 1f)]
	public float _LightTreshold = 0.2f;

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

	private Material m_Material;

	protected Material material
	{
		get
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)(object)m_Material == (Object)null)
			{
				m_Material = new Material(shader);
				((Object)m_Material).hideFlags = (HideFlags)61;
			}
			return m_Material;
		}
	}

	public static event OnNightVisionEnabledDelegate onNightVisionEnabled;

	private void OnEnable()
	{
		if (Nightvision.onNightVisionEnabled != null)
		{
			Nightvision.onNightVisionEnabled(enabled: true);
		}
	}

	protected virtual void Start()
	{
		if (!SystemInfo.supportsImageEffects)
		{
			((Behaviour)this).enabled = false;
			return;
		}
		if ((Object)(object)shader == (Object)null)
		{
			shader = Shader.Find("Hidden/NightVision");
		}
		if (!Object.op_Implicit((Object)(object)shader) || !shader.isSupported)
		{
			((Behaviour)this).enabled = false;
		}
	}

	protected virtual void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)m_Material))
		{
			Object.DestroyImmediate((Object)(object)m_Material);
		}
		if (Nightvision.onNightVisionEnabled != null)
		{
			Nightvision.onNightVisionEnabled(enabled: false);
		}
	}

	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		material.SetTexture("_NoiseTex", (Texture)(object)_NoiseTex);
		material.SetTexture("_MaskTex", (Texture)(object)_MaskTex);
		material.SetFloat("_LuminanceThreshold", _LuminanceThreshold);
		material.SetFloat("_ColorAmplification", _ColorAmplification);
		material.SetFloat("_LightTreshold", _LightTreshold);
		material.SetFloat("_Zoom", _Zoom);
		Graphics.Blit((Texture)(object)source, destination, material);
	}
}
public class ShockShader : MonoBehaviour
{
	private float counter = 0f;

	private bool animate = false;

	private void Start()
	{
	}

	private void Update()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetButtonDown("Fire1"))
		{
			counter = 0f;
			Ray val = Camera.main.ScreenPointToRay(Input.mousePosition);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, float.PositiveInfinity) && (Object)(object)((Component)((RaycastHit)(ref val2)).collider).gameObject == (Object)(object)((Component)this).gameObject)
			{
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(((RaycastHit)(ref val2)).point.x - ((Component)this).transform.position.x + 0.5f, ((RaycastHit)(ref val2)).point.y - ((Component)this).transform.position.y + 0.5f, 0f);
				((Component)this).GetComponent<Renderer>().material.SetVector("_Center", new Vector4(val3.x, val3.y, 0f, 0f));
				((Component)this).GetComponent<Renderer>().material.SetFloat("_WaveTime", 0f);
				animate = true;
			}
		}
		if (animate)
		{
			if (counter < 1.5f)
			{
				counter += Time.deltaTime;
				((Component)this).GetComponent<Renderer>().material.SetFloat("_WaveTime", counter);
			}
			else
			{
				animate = false;
			}
		}
	}
}
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Vision/HeatVision")]
public class HeatVision : MonoBehaviour
{
	public delegate void OnHeatVisionEnabledDelegate(bool enabled);

	public Shader shader;

	[Range(0.1f, 0.9f)]
	public float _ColorAmplification = 0.4f;

	private Material m_Material;

	protected Material material
	{
		get
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)(object)m_Material == (Object)null)
			{
				m_Material = new Material(shader);
				((Object)m_Material).hideFlags = (HideFlags)61;
			}
			return m_Material;
		}
	}

	public static event OnHeatVisionEnabledDelegate onHeatVisionEnabled;

	private void OnEnable()
	{
		if (HeatVision.onHeatVisionEnabled != null)
		{
			HeatVision.onHeatVisionEnabled(enabled: true);
		}
	}

	protected virtual void Start()
	{
		if (!SystemInfo.supportsImageEffects)
		{
			((Behaviour)this).enabled = false;
			return;
		}
		if ((Object)(object)shader == (Object)null)
		{
			shader = Shader.Find("Hidden/ThermalVision2");
		}
		if (!Object.op_Implicit((Object)(object)shader) || !shader.isSupported)
		{
			((Behaviour)this).enabled = false;
		}
	}

	protected virtual void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)m_Material))
		{
			Object.DestroyImmediate((Object)(object)m_Material);
		}
		if (HeatVision.onHeatVisionEnabled != null)
		{
			HeatVision.onHeatVisionEnabled(enabled: false);
		}
	}

	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		material.SetFloat("_ColorAmplification", _ColorAmplification);
		Graphics.Blit((Texture)(object)source, destination, material);
	}
}
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Vision/ThermalVision")]
public class ThermalVision : MonoBehaviour
{
	public delegate void OnThermalVisionEnabledDelegate(bool enabled);

	public Shader shader;

	[Range(0.1f, 0.9f)]
	public float _ColorAmplification = 0.6f;

	private Material m_Material;

	protected Material material
	{
		get
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)(object)m_Material == (Object)null)
			{
				m_Material = new Material(shader);
				((Object)m_Material).hideFlags = (HideFlags)61;
			}
			return m_Material;
		}
	}

	public static event OnThermalVisionEnabledDelegate onThermalVisionEnabled;

	private void OnEnable()
	{
		if (ThermalVision.onThermalVisionEnabled != null)
		{
			ThermalVision.onThermalVisionEnabled(enabled: true);
		}
	}

	protected virtual void Start()
	{
		if (!SystemInfo.supportsImageEffects)
		{
			((Behaviour)this).enabled = false;
			return;
		}
		if ((Object)(object)shader == (Object)null)
		{
			shader = Shader.Find("Hidden/ThermalVision");
		}
		if (!Object.op_Implicit((Object)(object)shader) || !shader.isSupported)
		{
			((Behaviour)this).enabled = false;
		}
	}

	protected virtual void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)m_Material))
		{
			Object.DestroyImmediate((Object)(object)m_Material);
		}
		if (ThermalVision.onThermalVisionEnabled != null)
		{
			ThermalVision.onThermalVisionEnabled(enabled: false);
		}
	}

	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		material.SetFloat("_ColorAmplification", _ColorAmplification);
		Graphics.Blit((Texture)(object)source, destination, material);
	}
}
[AddComponentMenu("Camera-Control/Mouse Look")]
public class MouseLook : MonoBehaviour
{
	public enum RotationAxes
	{
		MouseXAndY,
		MouseX,
		MouseY
	}

	public RotationAxes axes = RotationAxes.MouseXAndY;

	public float sensitivityX = 15f;

	public float sensitivityY = 15f;

	public float minimumX = -360f;

	public float maximumX = 360f;

	public float minimumY = -60f;

	public float maximumY = 60f;

	private float rotationY = 0f;

	private void Update()
	{
		//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_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		if (axes == RotationAxes.MouseXAndY)
		{
			float num = ((Component)this).transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;
			rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
			rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);
			((Component)this).transform.localEulerAngles = new Vector3(0f - rotationY, num, 0f);
		}
		else if (axes == RotationAxes.MouseX)
		{
			((Component)this).transform.Rotate(0f, Input.GetAxis("Mouse X") * sensitivityX, 0f);
		}
		else
		{
			rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
			rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);
			((Component)this).transform.localEulerAngles = new Vector3(0f - rotationY, ((Component)this).transform.localEulerAngles.y, 0f);
		}
	}

	private void Start()
	{
		if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<Rigidbody>()))
		{
			((Component)this).GetComponent<Rigidbody>().freezeRotation = true;
		}
	}
}
public class Move : MonoBehaviour
{
	[SerializeField]
	private float amplitude = 1f;

	[SerializeField]
	private float timeScale = 1f;

	private Transform transform;

	private Vector3 startPosition;

	private void Start()
	{
		//IL_0014: 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)
		transform = ((Component)this).GetComponent<Transform>();
		startPosition = transform.position;
	}

	private void Update()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		transform.position = new Vector3(amplitude * Mathf.Sin(Time.time * timeScale), startPosition.y, startPosition.z);
	}
}
public class Rotate : MonoBehaviour
{
	[SerializeField]
	private float amplitude;

	[SerializeField]
	private float timeScale;

	private Transform transform;

	private Quaternion startRotation;

	private void Start()
	{
		//IL_0014: 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)
		transform = ((Component)this).GetComponent<Transform>();
		startRotation = transform.rotation;
	}

	private void Update()
	{
		//IL_0008: 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)
		transform.rotation = startRotation * Quaternion.Euler(0f, 0f, amplitude * Mathf.Cos(Time.time * timeScale));
	}
}
[ExecuteInEditMode]
public class BezierCurveLineRenderer : MonoBehaviour
{
	public Transform[] points;

	public LineRenderer lineRenderer;

	public int vertexCount = 12;

	private void Start()
	{
	}

	private void Update()
	{
		//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)
		//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_0091: Unknown result type (might be due to invalid IL or missing references)
		if (points == null || points.Length <= 0)
		{
			lineRenderer.positionCount = 0;
			lineRenderer.SetPositions((Vector3[])(object)new Vector3[1] { Vector3.zero });
			return;
		}
		List<Vector3> list = new List<Vector3>();
		for (float num = 0f; num <= 1f; num += 1f / (float)vertexCount)
		{
			Vector3 item = CalculateBezierPoint(num, points.Select((Transform point) => point.position));
			list.Add(item);
		}
		lineRenderer.positionCount = list.Count;
		lineRenderer.SetPositions(list.ToArray());
	}

	private Vector3 CalculateBezierPoint(float ratio, IEnumerable<Vector3> points)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		if (points.Count() == 1)
		{
			return points.First();
		}
		LinkedList<Vector3> linkedList = new LinkedList<Vector3>();
		Vector3? val = null;
		foreach (Vector3 point in points)
		{
			if (!val.HasValue)
			{
				val = point;
				continue;
			}
			linkedList.AddLast(Vector3.Lerp(val.Value, point, ratio));
			val = point;
		}
		return CalculateBezierPoint(ratio, linkedList);
	}

	private void OnDrawGizmos()
	{
	}
}
public class Chunk : MonoBehaviour
{
	public int width;

	private Color[,,] chunkData;

	private void Awake()
	{
		chunkData = new Color[width, width, width];
	}

	internal void SetBlock(int x, int y, int z, Color blockData)
	{
		//IL_000f: 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)
		chunkData[x, y, z] = blockData;
		((Component)this).SendMessage("BlockUpdate", (object)this);
	}

	internal Color GetBlock(int x, int y, int z)
	{
		//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_0015: Unknown result type (might be due to invalid IL or missing references)
		return chunkData[x, y, z];
	}
}
[RequireComponent(typeof(MeshFilter))]
public class ChunkMeshGenerator : MonoBehaviour
{
	private class Block
	{
		public int x;

		public int y;

		public int z;

		public Color color;

		public Block(int x, int y, int z, Color color)
		{
			//IL_001d: 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)
			this.x = x;
			this.y = y;
			this.z = z;
			this.color = color;
		}
	}

	private MeshFilter filter;

	private void BlockUpdate(Chunk updatedChunk)
	{
		Mesh mesh = GenerateMesh(updatedChunk);
		if ((Object)(object)filter == (Object)null)
		{
			filter = ((Component)this).GetComponent<MeshFilter>();
		}
		filter.mesh = mesh;
	}

	private Mesh GenerateMesh(Chunk updatedChunk)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0045: 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_0052: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = new Mesh();
		List<Color> list = new List<Color>();
		List<Vector3> list2 = new List<Vector3>();
		List<int> list3 = new List<int>();
		for (int i = 0; i < updatedChunk.width; i++)
		{
			for (int j = 0; j < updatedChunk.width; j++)
			{
				for (int k = 0; k < updatedChunk.width; k++)
				{
					Block block = CheckBlock(updatedChunk, i, j, k);
					if (block.color != default(Color))
					{
						Block[] adjacentBlocks = new Block[6]
						{
							CheckBlock(updatedChunk, i - 1, j, k),
							CheckBlock(updatedChunk, i + 1, j, k),
							CheckBlock(updatedChunk, i, j - 1, k),
							CheckBlock(updatedChunk, i, j + 1, k),
							CheckBlock(updatedChunk, i, j, k - 1),
							CheckBlock(updatedChunk, i, j, k + 1)
						};
						GenerateMeshForAdjacentBlocks(block, adjacentBlocks, list, list3, list2);
					}
				}
			}
		}
		val.SetVertices(list2);
		val.SetColors(list);
		val.SetTriangles(list3, 0);
		return val;
	}

	private void GenerateMeshForAdjacentBlocks(Block block, Block[] adjacentBlocks, List<Color> generatedColors, List<int> generatedTriangles, List<Vector3> generatedVertices)
	{
		//IL_0011: 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_001e: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f1: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: 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_0164: 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_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: 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_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = default(Vector3);
		Vector3 val2 = default(Vector3);
		foreach (Block block2 in adjacentBlocks)
		{
			if (block2.color == default(Color))
			{
				((Vector3)(ref val))..ctor((float)block.x, (float)block.y, (float)block.z);
				((Vector3)(ref val2))..ctor((float)block2.x, (float)block2.y, (float)block2.z);
				bool flag = block.x != block2.x;
				bool flag2 = block.y != block2.y;
				bool flag3 = block.z != block2.z;
				Vector3 zero = Vector3.zero;
				Vector3 zero2 = Vector3.zero;
				if (flag)
				{
					zero = Vector3.forward;
					zero2 = Vector3.up;
				}
				else if (flag2)
				{
					zero = Vector3.right;
					zero2 = Vector3.forward;
				}
				else
				{
					zero = Vector3.right;
					zero2 = Vector3.up;
				}
				zero *= 0.5f;
				zero2 *= 0.5f;
				Vector3 val3 = (val2 + val) / 2f;
				int count = generatedVertices.Count;
				generatedVertices.Add(val3 + zero + zero2);
				generatedVertices.Add(val3 + zero - zero2);
				generatedVertices.Add(val3 - zero + zero2);
				generatedVertices.Add(val3 - zero - zero2);
				generatedColors.Add(block.color);
				generatedColors.Add(block.color);
				generatedColors.Add(block.color);
				generatedColors.Add(block.color);
				generatedTriangles.Add(count);
				generatedTriangles.Add(count + 1);
				generatedTriangles.Add(count + 2);
				generatedTriangles.Add(count + 1);
				generatedTriangles.Add(count + 2);
				generatedTriangles.Add(count + 3);
			}
		}
	}

	private Block CheckBlock(Chunk updatedChunk, int x, int y, int z)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		if (x < 0 || y < 0 || z < 0 || x >= updatedChunk.width || y >= updatedChunk.width || z >= updatedChunk.width)
		{
			return new Block(x, y, z, default(Color));
		}
		return new Block(x, y, z, updatedChunk.GetBlock(x, y, z));
	}
}
public class PerlinChunkGenerator : MonoBehaviour
{
	public int seed;

	private Chunk chunk;

	private void Start()
	{
		chunk = ((Component)this).GetComponent<Chunk>();
		Generate(chunk, seed);
	}

	private void Generate(Chunk chunk, int seed)
	{
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00d8: 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)
		Random.InitState(seed);
		for (int i = 0; i < chunk.width; i++)
		{
			for (int j = 0; j < chunk.width; j++)
			{
				for (int k = 0; k < chunk.width; k++)
				{
					float num = (Mathf.PerlinNoise((float)i / (float)chunk.width, (float)j / (float)chunk.width) + Mathf.PerlinNoise((float)i / (float)chunk.width, (float)k / (float)chunk.width) + Mathf.PerlinNoise((float)k / (float)chunk.width, (float)j / (float)chunk.width)) / 3f;
					Color blockData = default(Color);
					if ((double)num > 0.75)
					{
						blockData = Color.red;
					}
					else if ((double)num > 0.5)
					{
						blockData = Color.green;
					}
					else if ((double)num > 0.25)
					{
						blockData = Color.blue;
					}
					chunk.SetBlock(i, j, k, blockData);
				}
			}
		}
	}
}
public class BuildHeightMap : MonoBehaviour
{
	public float height;

	public float offset = 0.25f;

	public float step = 0.25f;

	public Material material;

	private void Start()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		for (float num = offset; num < height; num += step)
		{
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)4);
			MeshRenderer component = val.GetComponent<MeshRenderer>();
			((Renderer)component).material = material;
			val.transform.position = Vector3.up * num;
		}
	}

	private void Update()
	{
	}
}
public class ConwaysGameOfLife : MonoBehaviour
{
	public Texture input;

	public int width = 512;

	public int height = 512;

	public ComputeShader compute;

	public RenderTexture renderTexPing;

	public RenderTexture renderTexPong;

	public Material material;

	private int kernel;

	private bool pingPong;

	private void Start()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		if (height >= 1 && width >= 1)
		{
			kernel = compute.FindKernel("GameOfLife");
			renderTexPing = new RenderTexture(width, height, 24);
			((Texture)renderTexPing).wrapMode = (TextureWrapMode)0;
			renderTexPing.enableRandomWrite = true;
			((Texture)renderTexPing).filterMode = (FilterMode)0;
			renderTexPing.useMipMap = false;
			renderTexPing.Create();
			renderTexPong = new RenderTexture(width, height, 24);
			((Texture)renderTexPong).wrapMode = (TextureWrapMode)0;
			renderTexPong.enableRandomWrite = true;
			((Texture)renderTexPong).filterMode = (FilterMode)0;
			renderTexPong.useMipMap = false;
			renderTexPong.Create();
			Graphics.Blit(input, renderTexPing);
			pingPong = true;
			compute.SetFloat("Width", (float)width);
			compute.SetFloat("Height", (float)height);
		}
	}

	private void Update()
	{
		if (height >= 1 && width >= 1)
		{
			if (pingPong)
			{
				compute.SetTexture(kernel, "Input", (Texture)(object)renderTexPing);
				compute.SetTexture(kernel, "Result", (Texture)(object)renderTexPong);
				compute.Dispatch(kernel, width / 8, height / 8, 1);
				material.mainTexture = (Texture)(object)renderTexPong;
				pingPong = false;
			}
			else
			{
				compute.SetTexture(kernel, "Input", (Texture)(object)renderTexPong);
				compute.SetTexture(kernel, "Result", (Texture)(object)renderTexPing);
				compute.Dispatch(kernel, width / 8, height / 8, 1);
				material.mainTexture = (Texture)(object)renderTexPing;
				pingPong = true;
			}
		}
	}
}
[ImageEffectAllowedInSceneView]
[ExecuteInEditMode]
public class NightVisionImageEffect : MonoBehaviour
{
	private Camera camera;

	public Material effectMaterial;

	private void OnEnable()
	{
		camera = ((Component)this).GetComponent<Camera>();
		camera.depthTextureMode = (DepthTextureMode)1;
	}

	[ImageEffectOpaque]
	private void OnRenderImage(RenderTexture src, RenderTexture dst)
	{
		Graphics.Blit((Texture)(object)src, dst, effectMaterial);
	}
}
[ExecuteInEditMode]
public class PixelateImageEffect : MonoBehaviour
{
	public Material effectMaterial;

	private void OnRenderImage(RenderTexture src, RenderTexture dst)
	{
		Graphics.Blit((Texture)(object)src, dst, effectMaterial);
	}
}
[ExecuteInEditMode]
public class TracerPositionUpdater : MonoBehaviour
{
	public Material material;

	public Transform parent;

	private void Start()
	{
		if ((Object)(object)parent == (Object)null)
		{
			parent = ((Component)Camera.main).transform;
		}
	}

	private void Update()
	{
		//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)
		//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_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)material != (Object)null)
		{
			material.SetVector("_EchoLocation", new Vector4(((Component)this).transform.position.x, ((Component)this).transform.position.y, ((Component)this).transform.position.z, 0f));
		}
	}
}
[ExecuteInEditMode]
public class MagicLightSource : MonoBehaviour
{
	public Material reveal;

	public Light light;

	private void Start()
	{
	}

	private void Update()
	{
		//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_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		reveal.SetVector("_LightPosition", Vector4.op_Implicit(((Component)light).transform.position));
		reveal.SetVector("_LightDirection", Vector4.op_Implicit(-((Component)light).transform.forward));
		reveal.SetFloat("_LightAngle", light.spotAngle);
	}
}
public class ProjectileAttackSimulator : MonoBehaviour
{
	public float radius;

	public float shotCooldown;

	private float timer;

	public GameObject projectile;

	private void Start()
	{
	}

	private void Update()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		timer += Time.deltaTime;
		while (timer > shotCooldown)
		{
			timer -= shotCooldown;
			Vector3 val = Random.onUnitSphere * radius;
			Quaternion val2 = Quaternion.LookRotation(-val);
			Object.Instantiate<GameObject>(projectile, val, val2);
			Debug.Log((object)"New Projectile");
		}
	}
}
[ExecuteInEditMode]
public class ShieldController : MonoBehaviour
{
	private static readonly Vector4[] defaultEmptyVector = (Vector4[])(object)new Vector4[1]
	{
		new Vector4(0f, 0f, 0f, 0f)
	};

	public Vector4[] points;

	public Material shieldMaterial;

	private void Start()
	{
		points = (Vector4[])(object)new Vector4[50];
	}

	private void Update()
	{
		shieldMaterial.SetInt("_PointsSize", points.Length);
		if (points.Length <= 0)
		{
			shieldMaterial.SetVectorArray("_Points", defaultEmptyVector);
		}
		else
		{
			shieldMaterial.SetVectorArray("_Points", points);
		}
	}
}
public class ShieldProjectile : MonoBehaviour
{
	public float projectileBias = 0.25f;

	public float speed = 10f;

	private void Start()
	{
	}

	private void Update()
	{
		//IL_0015: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0052: 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)
		float num = speed * Time.deltaTime;
		Transform transform = ((Component)this).transform;
		transform.position += ((Component)this).transform.forward * num;
		Ray val = default(Ray);
		((Ray)(ref val))..ctor(((Component)this).transform.position, ((Component)this).transform.forward);
		RaycastHit val2 = default(RaycastHit);
		if (Physics.Raycast(val, ref val2, num + projectileBias))
		{
			((Component)((RaycastHit)(ref val2)).collider).gameObject.SendMessage("OnProjectileHit", (object)((RaycastHit)(ref val2)).point, (SendMessageOptions)1);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[ExecuteInEditMode]
public class GrassPointCloudRenderer : MonoBehaviour
{
	private Mesh mesh;

	public MeshFilter filter;

	public int seed;

	public Vector2 size;

	[Range(1f, 60000f)]
	public int grassNumber;

	public float startHeight = 1000f;

	public float grassOffset = 0f;

	private Vector3? lastPosition = null;

	private List<Matrix4x4> materices;

	private void Update()
	{
		//IL_0026: 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_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_00f7: 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_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Expected O, but got Unknown
		//IL_0207: 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_012f: 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)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: 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_0192: Unknown result type (might be due to invalid IL or missing references)
		if (lastPosition.HasValue)
		{
			Vector3? val = lastPosition;
			if (val.HasValue && !(val.GetValueOrDefault() != ((Component)this).transform.position))
			{
				return;
			}
		}
		Random.InitState(seed);
		List<Vector3> list = new List<Vector3>(grassNumber);
		int[] array = new int[grassNumber];
		List<Color> list2 = new List<Color>(grassNumber);
		List<Vector3> list3 = new List<Vector3>(grassNumber);
		Ray val2 = default(Ray);
		RaycastHit val3 = default(RaycastHit);
		for (int i = 0; i < grassNumber; i++)
		{
			Vector3 position = ((Component)this).transform.position;
			position.y = startHeight;
			position.x += size.x * Random.Range(-0.5f, 0.5f);
			position.z += size.y * Random.Range(-0.5f, 0.5f);
			((Ray)(ref val2))..ctor(position, Vector3.down);
			if (Physics.Raycast(val2, ref val3))
			{
				Vector3 point = ((RaycastHit)(ref val3)).point;
				point.y += grassOffset;
				point -= ((Component)this).transform.position;
				list.Add(point);
				array[i] = i;
				list2.Add(new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f));
				list3.Add(((RaycastHit)(ref val3)).normal);
			}
		}
		mesh = new Mesh();
		mesh.SetVertices(list);
		mesh.SetIndices(array, (MeshTopology)5, 0);
		mesh.SetColors(list2);
		mesh.SetNormals(list3);
		filter.mesh = mesh;
		lastPosition = ((Component)this).transform.position;
	}
}
[ExecuteInEditMode]
public class GrassRenderer : MonoBehaviour
{
	public Mesh grassMesh;

	public Material material;

	public int seed;

	public Vector2 size;

	[Range(1f, 1000f)]
	public int grassNumber;

	public float startHeight = 1000f;

	public float grassOffset = 0f;

	private void Update()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		Random.InitState(seed);
		List<Matrix4x4> list = new List<Matrix4x4>(grassNumber);
		Ray val = default(Ray);
		RaycastHit val2 = default(RaycastHit);
		for (int i = 0; i < grassNumber; i++)
		{
			Vector3 position = ((Component)this).transform.position;
			position.y = startHeight;
			position.x += size.x * Random.Range(-0.5f, 0.5f);
			position.z += size.y * Random.Range(-0.5f, 0.5f);
			((Ray)(ref val))..ctor(position, Vector3.down);
			if (Physics.Raycast(val, ref val2))
			{
				position = ((RaycastHit)(ref val2)).point;
				position.y += grassOffset;
				list.Add(Matrix4x4.TRS(position, Quaternion.identity, Vector3.one));
			}
		}
		Graphics.DrawMeshInstanced(grassMesh, 0, material, list);
	}
}
[ExecuteInEditMode]
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(Light))]
public class VolumetricLightMesh : MonoBehaviour
{
	public float maximumOpacity = 0.25f;

	private MeshFilter filter;

	private Light light;

	private Mesh mesh;

	private void Start()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		filter = ((Component)this).GetComponent<MeshFilter>();
		light = ((Component)this).GetComponent<Light>();
		if ((int)light.type != 0)
		{
			Debug.LogError((object)"Attached Volumetric Light Mesh to a non-supported Light Type. Please use Spotlight lights.");
		}
	}

	private void Update()
	{
		mesh = BuildMesh();
		filter.mesh = mesh;
	}

	private Mesh BuildMesh()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//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_0075: 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_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_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_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		mesh = new Mesh();
		float num = Mathf.Tan(light.spotAngle * 0.5f * ((float)Math.PI / 180f)) * light.range;
		mesh.vertices = (Vector3[])(object)new Vector3[5]
		{
			new Vector3(0f, 0f, 0f),
			new Vector3(num, num, light.range),
			new Vector3(0f - num, num, light.range),
			new Vector3(0f - num, 0f - num, light.range),
			new Vector3(num, 0f - num, light.range)
		};
		mesh.colors = (Color[])(object)new Color[5]
		{
			new Color(light.color.r, light.color.g, light.color.b, light.color.a * maximumOpacity),
			new Color(light.color.r, light.color.g, light.color.b, 0f),
			new Color(light.color.r, light.color.g, light.color.b, 0f),
			new Color(light.color.r, light.color.g, light.color.b, 0f),
			new Color(light.color.r, light.color.g, light.color.b, 0f)
		};
		mesh.triangles = new int[12]
		{
			0, 1, 2, 0, 2, 3, 0, 3, 4, 0,
			4, 1
		};
		return mesh;
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace sgtbrooks.ModularHK417_and_NightVision_p2
{
	[BepInPlugin("sgtbrooks.ModularHK417_and_NightVision_p2", "ModularHK417_and_NightVision_p2", "3.0.1")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
	[BepInDependency("nrgill28.Sodalite", "1.4.2")]
	public class ModularHK417_and_NightVision_p2Plugin : 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(), "sgtbrooks.ModularHK417_and_NightVision_p2");
			OtherLoader.RegisterDirectLoad(BasePath, "sgtbrooks.ModularHK417_and_NightVision_p2", "", "", "other_items", "");
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularhk417_and_nightvision_p2"));
		}
	}
}
public class CameraEffect : MonoBehaviour
{
	public Material m_Mat;

	public bool m_Enable = true;

	[Range(0.1f, 0.8f)]
	public float m_ThermalHigh = 0.3f;

	[Range(0.1f, 1f)]
	public float m_BlurAmount = 0.5f;

	[Range(0.1f, 1f)]
	public float m_DimensionsX = 0.5f;

	[Range(0.1f, 1f)]
	public float m_DimensionsY = 0.5f;

	private RenderTexture m_RT;

	private void Start()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		m_RT = new RenderTexture(Screen.width, Screen.height, 0);
	}

	private void Update()
	{
		//IL_0038: 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)
		float num = Random.Range(0f, 1f);
		float num2 = Random.Range(0f, 1f);
		m_Mat.SetVector("_Rnd", new Vector4(num, num2, 0f, 0f));
		m_Mat.SetVector("_Dimensions", new Vector4(m_DimensionsX, m_DimensionsY, 0f, 0f));
		m_Mat.SetFloat("_HotLight", m_ThermalHigh);
		m_Mat.SetFloat("_BlurAmount", m_BlurAmount);
	}

	private void OnRenderImage(RenderTexture src, RenderTexture dst)
	{
		if (m_Enable)
		{
			Graphics.Blit((Texture)(object)src, m_RT, m_Mat, 0);
			Graphics.Blit((Texture)(object)m_RT, dst, m_Mat, 1);
		}
		else
		{
			Graphics.Blit((Texture)(object)src, dst);
		}
	}

	private void OnGUI()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		int num = 320;
		GUI.Box(new Rect((float)(Screen.width / 2 - num / 2), 10f, (float)num, 25f), "Thermal Vision Demo");
	}
}
namespace H3VRUtils.Vehicles
{
	public class ButtonIgnition : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public VehicleAudioSet audioSet;

		public float ignitionTime;

		private float m_it;

		public float failChance;

		public Random rand;

		public void Start()
		{
			rand = new Random();
		}

		public void BeginInteraction(FVRViveHand hand)
		{
			m_it = ignitionTime;
			if (!vehicle.isOn)
			{
				if (vehicle.isForciblyOff)
				{
				}
			}
			else
			{
				vehicle.TurnOffEngine(forcibly: false);
			}
		}

		public void UpdateInteraction(FVRViveHand hand)
		{
			m_it -= Time.fixedDeltaTime;
			if (m_it <= 0f)
			{
				float num = (float)rand.Next(0, 10000) / 100f;
				if (!(num <= failChance))
				{
					vehicle.TurnOnEngine(forcibly: false);
				}
			}
		}
	}
}
namespace H3VRUtils.Vehicles.Core
{
	public class DamagingArea : MonoBehaviour
	{
		public VehicleControl vehicle;

		public float damageMult = 15f;

		public float sharpyness = 50f;
	}
}
namespace H3VRUtils.Vehicles
{
	[Serializable]
	public class DriveShiftNode
	{
		public Vector3 localposition;

		public Vector3 rotation;

		public int left = -1;

		public int up = -1;

		public int right = -1;

		public int down = -1;

		public int gear = 0;
	}
	public class DriveShift : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public Text gearText;

		public int currentNode;

		public List<DriveShiftNode> driveShiftNodes;

		public VehicleAudioSet audioSet;

		public void Update()
		{
			if (vehicle.carSetting.automaticGear)
			{
				if (vehicle.currentGear > 0 && vehicle.speed > 1f)
				{
					gearText.text = vehicle.currentGear.ToString();
				}
				else if (vehicle.speed > 1f)
				{
					gearText.text = "R";
				}
				else
				{
					gearText.text = "N";
				}
			}
			else if (vehicle.NeutralGear)
			{
				gearText.text = "N";
			}
			else if (vehicle.currentGear != 0)
			{
				gearText.text = vehicle.currentGear.ToString();
			}
			else
			{
				gearText.text = "R";
			}
		}

		public void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].left != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].left;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].up != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].up;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].right != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].right;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].down != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].down;
			}
			if (flag)
			{
				vehicle.ShiftTo(driveShiftNodes[currentNode].gear);
				((Component)this).transform.localPosition = driveShiftNodes[currentNode].localposition;
				((Component)this).transform.localEulerAngles = driveShiftNodes[currentNode].rotation;
			}
		}
	}
	internal class EngineDamagable : VehicleDamagable
	{
		public GameObject particleSystemCentre;

		public GameObject explosionCentre;

		public float SmokeParticleHPThreshold;

		public float explosionStrength = 200f;

		public GameObject particleSmokePrefab;

		public GameObject particleFirePrefab;

		public GameObject explosionPrefab;

		public GameObject fixedMesh;

		public GameObject damagedMesh;

		public GameObject destroyedMesh;

		private ParticleSystem particleSmoke;

		private ParticleSystem particleFire;

		public void Start()
		{
			GameObject val = Object.Instantiate<GameObject>(particleSmokePrefab, particleSystemCentre.transform);
			particleSmoke = val.GetComponent<ParticleSystem>();
			particleSmoke.Stop();
			GameObject val2 = Object.Instantiate<GameObject>(particleFirePrefab, particleSystemCentre.transform);
			particleFire = val2.GetComponent<ParticleSystem>();
			particleFire.Stop();
		}

		public override void onHealthChange()
		{
			if (HPLessThanPercent(SmokeParticleHPThreshold))
			{
				if (!particleSmoke.IsAlive())
				{
					particleSmoke.Play();
				}
			}
			else
			{
				particleSmoke.Stop();
			}
			if (health < 0f)
			{
				fixedMesh.SetActive(false);
				damagedMesh.SetActive(false);
				destroyedMesh.SetActive(true);
			}
			else if (HPLessThanPercent(SmokeParticleHPThreshold))
			{
				fixedMesh.SetActive(false);
				damagedMesh.SetActive(true);
				destroyedMesh.SetActive(false);
			}
			else
			{
				fixedMesh.SetActive(true);
				damagedMesh.SetActive(false);
				destroyedMesh.SetActive(false);
			}
		}

		public override void onDeath()
		{
			//IL_002f: 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)
			particleFire.Play();
			if ((Object)(object)explosionPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(explosionPrefab, explosionCentre.transform.position, explosionCentre.transform.rotation);
			}
		}

		public override void whileDead()
		{
		}

		public override void whileUndead()
		{
		}

		public override void Heal(float heal)
		{
			base.Heal(heal);
		}

		public override void HealPercent(float percentHeal)
		{
			base.HealPercent(percentHeal);
		}

		public override void onUndeath()
		{
			particleFire.Stop();
		}

		public override void Damage()
		{
		}
	}
	internal class EnterVehicle : FVRInteractiveObject
	{
		public VehicleSeat vehicleSeat;
	}
	internal class ForkliftLift : FVRInteractiveObject
	{
		public Vector3 rotUpwards;

		public Vector3 rotRegular;

		public Vector3 rotDownwards;

		public GameObject lift;

		public float liftSpeed;

		public float minLiftY;

		public float maxLiftY;

		public void UpdateInteraction(FVRViveHand hand)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008e: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = lift.transform.position;
			((Component)this).transform.localEulerAngles = rotRegular;
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f)
			{
				position.y += liftSpeed / 50f;
				((Component)this).transform.localEulerAngles = rotUpwards;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f)
			{
				position.y -= liftSpeed / 50f;
				((Component)this).transform.localEulerAngles = rotDownwards;
			}
			if (position.y > maxLiftY)
			{
				position.y = maxLiftY;
			}
			else if (position.y < minLiftY)
			{
				position.y = minLiftY;
			}
			lift.transform.position = position;
		}
	}
	public class FuelNeedle : MonoBehaviour
	{
		public FuelTank tank;

		public GameObject needle;

		public bool isImperial;

		public Vector3 needleNoFuel;

		public Vector3 needleMaxFuel;

		public void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			float num = tank.currentFuel;
			if (isImperial)
			{
				num *= 0.6213712f;
			}
			float num2 = Mathf.InverseLerp(0f, tank.maxFuel, num);
			needle.transform.localEulerAngles = Vector3.Lerp(needleNoFuel, needleMaxFuel, num2);
		}
	}
	public class FuelTank : VehicleDamagable
	{
		public float currentFuel;

		public float maxFuel;

		public float fuelUsagePer1000Rpm = 0.01f;

		public float leakMult;

		public GameObject explosionEffect;

		public bool BlowsOnDeath;

		public AudioSource leakSound;

		private new void FixedUpdate()
		{
			base.FixedUpdate();
			float num = vehicle.motorRPM / 1000f;
			float num2 = num * (fuelUsagePer1000Rpm / 3000f);
			currentFuel -= num2;
			float num3 = Mathf.InverseLerp(maxHealth, 0f, health);
			currentFuel -= num3 * leakMult / 50f;
			if ((Object)(object)leakSound != (Object)null)
			{
				leakSound.volume = num3;
			}
		}

		public override void onDeath()
		{
			//IL_001f: 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)
			base.onDeath();
			if (BlowsOnDeath)
			{
				Object.Instantiate<GameObject>(explosionEffect, ((Component)this).transform.position, ((Component)this).transform.rotation);
			}
		}

		public float AddFuel(float fuelAdded)
		{
			currentFuel += fuelAdded;
			float num = maxFuel - currentFuel;
			if (num <= 0f)
			{
				return 0f;
			}
			return num;
		}
	}
}
namespace H3VRUtils
{
	internal class LockGun : MonoBehaviour
	{
		public FVRPhysicalObject Firearm;

		public GameObject LockPos;

		public void Update()
		{
		}
	}
}
namespace H3VRUtils.Vehicles
{
	public class ParkingBrakeClick : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public Vector3 positionOff;

		public Vector3 positionOn;

		public Vector3 rotationOff;

		public Vector3 rotationOn;

		public bool isOn;

		public VehicleAudioSet audioSet;
	}
	public class SpedometerNeedle : MonoBehaviour
	{
		public VehicleControl vehicle;

		public GameObject needle;

		public bool isImperial;

		public float maxSpeed;

		public Vector3 needleNoSpeed;

		public Vector3 needleMaxSpeed;

		public void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Abs(vehicle.speed);
			if (isImperial)
			{
				num *= 0.6213712f;
			}
			float num2 = Mathf.InverseLerp(0f, maxSpeed, num);
			needle.transform.localEulerAngles = Vector3.Lerp(needleNoSpeed, needleMaxSpeed, num2);
		}
	}
	internal class SteeringWheel : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public float resetLerpSpeed;

		public float maxRot;

		public bool isBraking;

		public bool reverseRot;

		[Header("Debug Values")]
		public Text rotText;

		public float rot;

		public float rh;

		public float lr;

		public float inlerp;

		public float lerp;

		public float rotAmt;

		public VehicleAudioSet audioSet;

		public void BeginInteraction(FVRViveHand hand)
		{
			//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_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_0059: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)this).transform.GetChild(0);
			child.parent = null;
			Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles;
			((Component)this).transform.LookAt(((Component)hand).transform);
			((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, ((Component)this).transform.localEulerAngles.y, localEulerAngles.z);
			child.parent = ((Component)this).transform;
		}

		public void EndInteraction(FVRViveHand hand)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0046: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)this).transform.GetChild(0);
			child.parent = null;
			((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, 0f, ((Component)this).transform.localEulerAngles.z);
			child.parent = ((Component)this).transform;
		}

		public void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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)
			Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles;
			((Component)this).transform.LookAt(((Component)hand).transform);
			Vector3 localEulerAngles2 = ((Component)this).transform.localEulerAngles;
			rot = Mathf.DeltaAngle((float)Math.Round(localEulerAngles2.y), (float)Math.Round(localEulerAngles.y));
			rotAmt += rot;
			if (rotAmt >= maxRot)
			{
				rotAmt = maxRot;
				((Component)this).transform.localEulerAngles = localEulerAngles;
			}
			else if (rotAmt <= 0f - maxRot)
			{
				rotAmt = 0f - maxRot;
				((Component)this).transform.localEulerAngles = localEulerAngles;
			}
			else
			{
				((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles2.y, localEulerAngles.z);
			}
			rh = localEulerAngles2.y;
			lr = localEulerAngles.y;
			SetRot();
			if (Vector2.Angle(hand.Input.TouchpadAxes, -Vector2.up) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.3f)
			{
				isBraking = !isBraking;
			}
			float triggerFloat = hand.Input.TriggerFloat;
			if (isBraking)
			{
				vehicle.accel = 0f - triggerFloat;
			}
			else
			{
				vehicle.accel = triggerFloat;
			}
		}

		private void FixedUpdate()
		{
			//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_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_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_0096: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.m_hand != (Object)null)
			{
				float num = resetLerpSpeed;
				if (rotAmt > 0f)
				{
					num = 0f - num;
				}
				if (rotAmt > num || rotAmt < 0f - num)
				{
					rotAmt += num;
					((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, ((Component)this).transform.localEulerAngles.y + num, ((Component)this).transform.localEulerAngles.z);
					vehicle.accel = 0f;
					SetRot();
				}
			}
		}

		private void SetRot()
		{
			if (rotAmt > 0f)
			{
				inlerp = Mathf.InverseLerp(0f, maxRot, rotAmt);
				lerp = 0f - Mathf.Lerp(0f, 1f, inlerp);
			}
			else
			{
				inlerp = Mathf.InverseLerp(0f, 0f - maxRot, rotAmt);
				lerp = Mathf.Lerp(0f, 1f, inlerp);
			}
			if (reverseRot)
			{
				lerp = 0f - lerp;
			}
			vehicle.steer = lerp;
		}
	}
	[CreateAssetMenu(fileName = "New Vehicle Audio Set", menuName = "Vehicles/AudioSet", order = 0)]
	public class VehicleAudioSet : ScriptableObject
	{
		private static AudioEvent defaultAE;

		public AudioEvent VehicleStart;

		public AudioEvent VehicleIdle;

		public AudioEvent VehicleStop;

		public AudioEvent HandbrakeUp;

		public AudioEvent HandbrakeDown;

		public AudioEvent ShiftDownGear;

		public AudioEvent RevLoop;

		public AudioEvent ShiftUpGear;

		public AudioEvent Brake;

		public AudioEvent BrakeLong;

		public AudioEvent PedalSwitchSound;

		static VehicleAudioSet()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//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)
			AudioEvent val = new AudioEvent();
			val.PitchRange = new Vector2(0.98f, 1.04f);
			val.VolumeRange = new Vector2(0.98f, 1.04f);
			val.ClipLengthRange = new Vector2(1f, 1f);
			defaultAE = val;
		}
	}
}
public enum ControlMode
{
	simple = 1,
	touch
}
public class VehicleControl : MonoBehaviour
{
	[Serializable]
	public class CarWheels
	{
		public ConnectWheel wheels;
	}

	[Serializable]
	public class ConnectWheel
	{
		public bool frontWheelDrive = true;

		public Transform frontRight;

		public Transform frontLeft;

		public WheelSetting frontSetting;

		public bool backWheelDrive = true;

		public Transform backRight;

		public Transform backLeft;

		public WheelSetting rearSetting;
	}

	[Serializable]
	public class WheelSetting
	{
		public float Radius = 0.4f;

		public float Weight = 1000f;

		public float Distance = 0.2f;
	}

	[Serializable]
	public class CarLights
	{
		public Light[] brakeLights;

		public Light[] reverseLights;
	}

	[Serializable]
	public class CarSounds
	{
		public AudioSource IdleEngine;

		public AudioSource LowEngine;

		public AudioSource HighEngine;

		public float minPitch = 1f;

		public float maxPitch = 10f;

		public AudioSource nitro;

		public AudioSource switchGear;
	}

	[Serializable]
	public class CarParticles
	{
		public GameObject brakeParticlePerfab;

		public ParticleSystem shiftParticle1;

		public ParticleSystem shiftParticle2;

		private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4];
	}

	[Serializable]
	public class CarSetting
	{
		public bool showNormalGizmos = false;

		public Transform carSteer;

		public HitGround[] hitGround;

		public List<Transform> cameraSwitchView;

		public float springs = 25000f;

		public float dampers = 1500f;

		public float carPower = 120f;

		public float shiftPower = 150f;

		public float brakePower = 8000f;

		public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f);

		public float maxSteerAngle = 25f;

		public float shiftDownRPM = 1500f;

		public float shiftUpRPM = 2500f;

		public float idleRPM = 500f;

		public float stiffness = 2f;

		public bool automaticGear = true;

		public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f };

		public float LimitBackwardSpeed = 60f;

		public float LimitForwardSpeed = 220f;
	}

	[Serializable]
	public class HitGround
	{
		public string tag = "street";

		public bool grounded = false;

		public AudioClip brakeSound;

		public AudioClip groundSound;

		public Color brakeColor;
	}

	private class WheelComponent
	{
		public Transform wheel;

		public WheelCollider collider;

		public Vector3 startPos;

		public float rotation = 0f;

		public float rotation2 = 0f;

		public float maxSteer;

		public bool drive;

		public float pos_y = 0f;

		public WheelSetting settings;
	}

	public ControlMode controlMode = ControlMode.simple;

	public bool activeControl = false;

	public CarWheels carWheels;

	public CarLights carLights;

	public CarSounds carSounds;

	public CarParticles carParticles;

	public CarSetting carSetting;

	[HideInInspector]
	public float steer = 0f;

	[HideInInspector]
	public float accel = 0f;

	[HideInInspector]
	public bool brake;

	private bool shifmotor;

	[HideInInspector]
	public float curTorque = 100f;

	[HideInInspector]
	public float powerShift = 100f;

	[HideInInspector]
	public bool shift;

	private float torque = 100f;

	[HideInInspector]
	public float speed = 0f;

	private float lastSpeed = -10f;

	private bool shifting = false;

	private float[] efficiencyTable = new float[22]
	{
		0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f,
		0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f,
		0.1f, 0.05f
	};

	private float efficiencyTableStep = 250f;

	private float Pitch;

	private float PitchDelay;

	private float shiftTime = 0f;

	private float shiftDelay = 0f;

	[HideInInspector]
	public int currentGear = 0;

	[HideInInspector]
	public bool NeutralGear = true;

	[HideInInspector]
	public float motorRPM = 0f;

	[HideInInspector]
	public bool Backward = false;

	[HideInInspector]
	public float accelFwd = 0f;

	[HideInInspector]
	public float accelBack = 0f;

	[HideInInspector]
	public float steerAmount = 0f;

	private float wantedRPM = 0f;

	private float w_rotate;

	private float slip;

	private float slip2 = 0f;

	private GameObject[] Particle = (GameObject[])(object)new GameObject[4];

	private Vector3 steerCurAngle;

	private Rigidbody myRigidbody;

	private WheelComponent[] wheels;

	public bool isOn = true;

	public bool isForciblyOff = false;

	private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		WheelComponent wheelComponent = new WheelComponent();
		GameObject val = new GameObject(((Object)wheel).name + "WheelCollider");
		val.transform.parent = ((Component)this).transform;
		val.transform.position = wheel.position;
		val.transform.eulerAngles = ((Component)this).transform.eulerAngles;
		pos_y = val.transform.localPosition.y;
		WheelCollider val2 = (WheelCollider)val.AddComponent(typeof(WheelCollider));
		wheelComponent.wheel = wheel;
		wheelComponent.collider = val.GetComponent<WheelCollider>();
		wheelComponent.drive = drive;
		wheelComponent.pos_y = pos_y;
		wheelComponent.maxSteer = maxSteer;
		wheelComponent.startPos = val.transform.localPosition;
		wheelComponent.settings = setting;
		return wheelComponent;
	}

	private void Awake()
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: 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_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_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
		if (carSetting.automaticGear)
		{
			NeutralGear = false;
		}
		myRigidbody = ((Component)((Component)this).transform).GetComponent<Rigidbody>();
		wheels = new WheelComponent[4];
		wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting);
		wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting);
		wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting);
		wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting);
		if (Object.op_Implicit((Object)(object)carSetting.carSteer))
		{
			steerCurAngle = carSetting.carSteer.localEulerAngles;
		}
		WheelComponent[] array = wheels;
		foreach (WheelComponent wheelComponent in array)
		{
			WheelCollider collider = wheelComponent.collider;
			collider.suspensionDistance = wheelComponent.settings.Distance;
			JointSpring suspensionSpring = collider.suspensionSpring;
			suspensionSpring.spring = carSetting.springs;
			suspensionSpring.damper = carSetting.dampers;
			collider.suspensionSpring = suspensionSpring;
			collider.radius = wheelComponent.settings.Radius;
			collider.mass = wheelComponent.settings.Weight;
			WheelFrictionCurve val = collider.forwardFriction;
			((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f;
			((WheelFrictionCurve)(ref val)).extremumSlip = 2f;
			((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f;
			((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness;
			collider.forwardFriction = val;
			val = collider.sidewaysFriction;
			((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f;
			((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f;
			((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness;
			collider.sidewaysFriction = val;
		}
	}

	public void TurnOnEngine(bool forcibly)
	{
		if (!isForciblyOff)
		{
			isOn = true;
		}
		else if (forcibly)
		{
			isForciblyOff = false;
			isOn = true;
		}
	}

	public void TurnOffEngine(bool forcibly)
	{
		isForciblyOff = forcibly;
		isOn = false;
	}

	public void ShiftTo(int newGear)
	{
		((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
		currentGear = newGear;
		if (currentGear == 0)
		{
			NeutralGear = true;
		}
		else
		{
			NeutralGear = false;
		}
		if (currentGear == -1)
		{
			currentGear = 0;
		}
	}

	public void ShiftUp(bool ignoreDelay)
	{
		float timeSinceLevelLoad = Time.timeSinceLevelLoad;
		if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1)
		{
			return;
		}
		((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
		if (!carSetting.automaticGear)
		{
			if (currentGear == 0)
			{
				if (NeutralGear)
				{
					currentGear++;
					NeutralGear = false;
				}
				else
				{
					NeutralGear = true;
				}
			}
			else
			{
				currentGear++;
			}
		}
		else
		{
			currentGear++;
		}
		shiftDelay = timeSinceLevelLoad + 1f;
		shiftTime = 1.5f;
	}

	public void ShiftDown(bool ignoreDelay)
	{
		float timeSinceLevelLoad = Time.timeSinceLevelLoad;
		if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear))
		{
			return;
		}
		((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
		if (!carSetting.automaticGear)
		{
			if (currentGear == 1)
			{
				if (!NeutralGear)
				{
					currentGear--;
					NeutralGear = true;
				}
			}
			else if (currentGear == 0)
			{
				NeutralGear = false;
			}
			else
			{
				currentGear--;
			}
		}
		else
		{
			currentGear--;
		}
		shiftDelay = timeSinceLevelLoad + 0.1f;
		shiftTime = 2f;
	}

	private void OnCollisionEnter(Collision collision)
	{
		//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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_00a1: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>()))
		{
			VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>();
			Vector3 relativeVelocity = collision.relativeVelocity;
			component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f);
			myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f);
			myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z);
		}
	}

	private void OnCollisionStay(Collision collision)
	{
		if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>()))
		{
			((Component)collision.transform.root).GetComponent<VehicleControl>().slip2 = 5f;
		}
	}

	private void Update()
	{
	}

	private void FixedUpdate()
	{
		//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_00b6: 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_0704: Unknown result type (might be due to invalid IL or missing references)
		//IL_0709: Unknown result type (might be due to invalid IL or missing references)
		//IL_0751: Unknown result type (might be due to invalid IL or missing references)
		//IL_075a: Unknown result type (might be due to invalid IL or missing references)
		//IL_075f: Unknown result type (might be due to invalid IL or missing references)
		//IL_079b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0acf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fd4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ee6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ef2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f0c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f17: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f1c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f25: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b3b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d23: Unknown result type (might be due to invalid IL or missing references)
		if (!isOn)
		{
			accel = 0f;
		}
		Vector3 velocity = myRigidbody.velocity;
		speed = ((Vector3)(ref velocity)).magnitude * 2.7f;
		if (speed < lastSpeed - 10f && slip < 10f)
		{
			slip = lastSpeed / 15f;
		}
		lastSpeed = speed;
		if (slip2 != 0f)
		{
			slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f);
		}
		myRigidbody.centerOfMass = carSetting.shiftCentre;
		if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive)
		{
			accel = 0f;
		}
		if (Object.op_Implicit((Object)(object)carSetting.carSteer))
		{
			carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f);
		}
		if (carSetting.automaticGear && currentGear == 1 && accel < 0f)
		{
			if (speed < 5f)
			{
				ShiftDown(ignoreDelay: false);
			}
		}
		else if (carSetting.automaticGear && currentGear == 0 && accel > 0f)
		{
			if (speed < 5f)
			{
				ShiftUp(ignoreDelay: false);
			}
		}
		else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake)
		{
			ShiftUp(ignoreDelay: false);
		}
		else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1)
		{
			ShiftDown(ignoreDelay: false);
		}
		if (speed < 1f)
		{
			Backward = true;
		}
		if (currentGear != 0 || !Backward)
		{
			Backward = false;
		}
		Light[] brakeLights = carLights.brakeLights;
		foreach (Light val in brakeLights)
		{
			if (brake || accel < 0f || speed < 1f)
			{
				val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f);
			}
			else
			{
				val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f);
			}
			((Behaviour)val).enabled = val.intensity != 0f;
		}
		Light[] reverseLights = carLights.reverseLights;
		foreach (Light val2 in reverseLights)
		{
			if (speed > 2f && currentGear == 0)
			{
				val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f);
			}
			else
			{
				val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f);
			}
			((Behaviour)val2).enabled = val2.intensity != 0f;
		}
		wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f;
		float num = 0f;
		int num2 = 0;
		bool flag = false;
		int num3 = 0;
		WheelComponent[] array = wheels;
		WheelHit val4 = default(WheelHit);
		foreach (WheelComponent wheelComponent in array)
		{
			WheelCollider collider = wheelComponent.collider;
			if (wheelComponent.drive)
			{
				num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm)));
				num2++;
			}
			if (brake || accel < 0f)
			{
				if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3])))
				{
					if (brake && accel > 0f)
					{
						slip = Mathf.Lerp(slip, 5f, accel * 0.01f);
					}
					else if (speed > 1f)
					{
						slip = Mathf.Lerp(slip, 1f, 0.002f);
					}
					else
					{
						slip = Mathf.Lerp(slip, 1f, 0.02f);
					}
					wantedRPM = 0f;
					collider.brakeTorque = carSetting.brakePower;
					wheelComponent.rotation = w_rotate;
				}
			}
			else
			{
				float brakeTorque;
				if (accel == 0f || NeutralGear)
				{
					float num5 = (collider.brakeTorque = 1000f);
					brakeTorque = num5;
				}
				else
				{
					float num5 = (collider.brakeTorque = 0f);
					brakeTorque = num5;
				}
				collider.brakeTorque = brakeTorque;
				slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((!(speed > 100f)) ? (slip = Mathf.Lerp(slip, 1.5f, 0.02f)) : (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f))));
				w_rotate = wheelComponent.rotation;
			}
			WheelFrictionCurve val3 = collider.forwardFriction;
			((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f;
			((WheelFrictionCurve)(ref val3)).extremumSlip = 2f;
			((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f;
			((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2);
			collider.forwardFriction = val3;
			val3 = collider.sidewaysFriction;
			((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2);
			((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer);
			collider.sidewaysFriction = val3;
			if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f)
			{
				if (powerShift == 0f)
				{
					shifmotor = false;
				}
				powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f);
				carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f);
				if (!carSounds.nitro.isPlaying)
				{
					((Component)carSounds.nitro).GetComponent<AudioSource>().Play();
				}
				curTorque = ((!(powerShift > 0f)) ? carSetting.carPower : carSetting.shiftPower);
				carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f);
				carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f);
			}
			else
			{
				if (powerShift > 20f)
				{
					shifmotor = true;
				}
				carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f);
				if (carSounds.nitro.volume == 0f)
				{
					carSounds.nitro.Stop();
				}
				powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f);
				curTorque = carSetting.carPower;
				carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f);
				carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f);
			}
			wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f);
			wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f);
			wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f);
			Vector3 localPosition = wheelComponent.wheel.localPosition;
			if (collider.GetGroundHit(ref val4))
			{
				if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab))
				{
					if ((Object)(object)Particle[num3] == (Object)null)
					{
						Particle[num3] = Object.Instantiate<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity);
						((Object)Particle[num3]).name = "WheelParticle";
						Particle[num3].transform.parent = ((Component)this).transform;