Decompiled source of MD MH6 MultiMission Helicopter v1.0.0

MD_MH6_MultiMission_Helicopter.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.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.AI;

[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]
public class GSCamera : GSCameraAux
{
}
[RequireComponent(typeof(WheelCollider))]
public class GSWheelAux : GLandingGear
{
}
public class GSurfaceCenter : GCenter
{
}
public class GSurfaceDrive : GDrive
{
}
[RequireComponent(typeof(Rigidbody))]
public class GSurfaceManager : GAircraft
{
}
public class GSurfacePivot : GPivot
{
}
public class GSurfaceTrail : GTrail
{
}
public class GSurfaceWindZone : GWindBasic
{
}
public class GSAreaHeight : MonoBehaviour
{
	private float baseHeight = 0f;

	public float coefHeight = 0.01f;

	public GameObject viewer = null;

	private Vector3 position = Vector3.zero;

	private void Start()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		baseHeight = ((Component)this).gameObject.transform.position.y;
	}

	private void Update()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)viewer != (Object)null)
		{
			position = ((Component)this).gameObject.transform.position;
			if (viewer.transform.position.y > baseHeight)
			{
				position.y = baseHeight + (viewer.transform.position.y - baseHeight) * coefHeight;
			}
			else
			{
				position.y = baseHeight;
			}
			((Component)this).gameObject.transform.position = position;
		}
	}
}
public class GSCameraAux : MonoBehaviour
{
	private GAircraft sm = null;

	public Camera attachToCamera = null;

	private GUITexture crossair = null;

	public Light sunlight = null;

	public bool sunlightAttach = true;

	public float sunlightAttachDistance = 100f;

	public float sunlightAttachFilter = 0.01f;

	public float inputHorizontalMouseSensivity = 3.4f;

	public float inputVerticalMouseSensivity = 2.1f;

	public float inputWheelMouseSensivity = 2.1f;

	public KeyCode inputExternalCameraKeyForToggle = (KeyCode)99;

	private bool inputExternalCameraKeyForToggled = false;

	private int currentCameraPosition = 0;

	private int countCameraPositions = 0;

	public KeyCode inputFixedPositionCameraKeyForToggle = (KeyCode)118;

	private bool inputFixedPositionCameraKeyForToggled = false;

	public bool enableRecoverVehicle = true;

	public bool enableRecoverVehicleReset = false;

	public Vector3 enableRecoverVehiclePosition = Vector3.zero;

	public Vector3 enableRecoverVehicleRotation = Vector3.zero;

	public KeyCode inputRecoverVehicleKeyForToggle = (KeyCode)111;

	private bool inputRecoverVehicleKeyForToggled = false;

	private bool cameraFixedPositionEnabled = false;

	private bool cameraExternalEnabled_lastValue = true;

	private bool cameraOnFixedUpdate = true;

	private int cameraOnFixedUpdate_count = 0;

	public GameObject cameraAlternateFollow = null;

	public bool globalSimulationScaleApplyToCamera = true;

	private float globalSimulationScale = 1f;

	public float cameraExternalMinHeight = -93f;

	public bool cameraExternalMinHeightAutoProbe = true;

	public LayerMask cameraExternalMinHeightAutoProbeLayermask = LayerMask.op_Implicit(-24);

	private float cameraExternalMinHeightScale = 1f;

	public float cameraExternalMinHeightAutoProbeDelta = 5f;

	public float cameraExternalMinHeightAutoProbeDeltaProbe = 1000f;

	public bool cameraExternalEnabled = false;

	public float cameraExternalNearClipPlane = 2f;

	public float cameraExternalFarClipPlane = 8000f;

	public float cameraExternalFilter = 0.1f;

	private float cameraExternalDistance = 2f;

	public float cameraExternalDistanceMin = 0.4f;

	public float cameraExternalDistanceMax = 101f;

	public float cameraExternalDistanceStep = 1.25f;

	public bool cameraExternalUpWorld = true;

	public float cameraInternalSensivity = 1.35f;

	public float cameraInternalNearClipPlane = 0.175f;

	public float cameraInternalFarClipPlane = 5000f;

	public float cameraInternalFilter = 1f;

	private float cameraInternalFov = 60f;

	public float cameraInternalFovMin = 15f;

	public float cameraInternalFovMax = 110f;

	public float cameraInternalFovStep = 15f;

	public bool cameraInternalUpWorld = false;

	public bool cameraInternalUpWorldMix = true;

	public float cameraInternalUpWorldMixing = 0.5f;

	public bool cameraInternalDontVertical = false;

	public bool cameraInternalDontVerticalMix = true;

	public float cameraInternalDontVerticalMixing = 0.5f;

	public float cameraInternalGsMixing = 0.05f;

	public float cameraInternalGsMax = 0.7f;

	public bool cameraInternalGsPosition = true;

	public float cameraInternalGsPositionDelta = 0.075f;

	public float cameraInternalGsPositionHDelta = 0.1f;

	public bool cameraInternalGsRotation = true;

	public float cameraInternalGsRotationDelta = 0.2f;

	public bool enableSpecialForce = true;

	public float specialForceMagnitude = 10000f;

	public KeyCode specialForceApplyZeroRotate = (KeyCode)117;

	public KeyCode specialForceApplyLeft = (KeyCode)106;

	public KeyCode specialForceApplyRight = (KeyCode)108;

	public KeyCode specialForceApplyForward = (KeyCode)105;

	public KeyCode specialForceApplyForceBack = (KeyCode)107;

	public KeyCode specialForceApplyForceUp = (KeyCode)121;

	public KeyCode specialForceApplyDown = (KeyCode)104;

	public bool fogRenderingEnabled = false;

	private FogMode initialFogMode = (FogMode)1;

	private float initialFogValue = 0f;

	public float fog01 = 0f;

	public float extremeFogValue = -1f;

	public bool skyboxRenderingEnabled = false;

	private Color skyboxRenderingColor;

	private Color skyboxRenderingColorTop;

	public float skyboxRenderingColorTopDeltaHeight = 10000f;

	public float skyboxRenderingColorUpwardsScatteringDistance = 30000f;

	public float skyboxRenderingColorDownwardsScatteringDistance = 3000000f;

	public bool skyboxRenderingColor0Enabled = false;

	public Color skyboxRenderingColor0 = skyboxRenderingColor0Default;

	public float skyboxRenderingColor0Height = 0f;

	public float skyboxRenderingColor0Distance = 1000f;

	public Color skyboxRenderingColor1 = skyboxRenderingColor1Default;

	public float skyboxRenderingColor1Height = 1500f;

	public Color skyboxRenderingColor2 = skyboxRenderingColor2Default;

	public float skyboxRenderingColor2Height = 15000f;

	public Color skyboxRenderingColor3 = skyboxRenderingColor3Default;

	public float skyboxRenderingColor3Height = 45000f;

	[NonSerialized]
	public int skyboxAngleColors;

	[NonSerialized]
	public Color32[] skyboxAngleColor = null;

	[NonSerialized]
	public int[,] skyboxSideAngles;

	[NonSerialized]
	public int[,] skyboxTopAngles;

	[NonSerialized]
	public int[,] skyboxBottomAngles;

	private Color tmp_skyboxRenderingColorm1;

	private Color tmp_skyboxRenderingColor0;

	private Color tmp_skyboxRenderingColor1;

	private Color tmp_skyboxRenderingColor2;

	private Color tmp_skyboxRenderingColor3;

	private Color tmp_skyboxRenderingColor4;

	public int skyboxTextureWidth = 64;

	public int skyboxTextureHeight = 64;

	public int skyboxRenderNth = 5;

	public int skyboxRenderSidesPerNth = 2;

	private int skyboxRenderNth_count = 0;

	private int skyboxRenderNth_tex = 0;

	private Skybox skyboxComponent = null;

	private Material skyboxMaterial = null;

	private Texture2D _FrontTex = null;

	private Texture2D _LeftTex = null;

	private Texture2D _RightTex = null;

	private Texture2D _BackTex = null;

	private Texture2D _UpTex = null;

	private Texture2D _DownTex = null;

	[NonSerialized]
	private Color32[] pixels = null;

	public bool searchSounds = true;

	[HideInInspector]
	public GUIText speedmeter;

	[HideInInspector]
	public GUIText autopilotmeter;

	[HideInInspector]
	public GameObject scene;

	[HideInInspector]
	public GameObject ground;

	[HideInInspector]
	public GameObject clouds;

	private AudioSource[] soundmin = null;

	private string soundmin_pivotId = "";

	private float soundmin_pivotScale = 1f;

	private float soundmin_pitchBase = 1f;

	private float soundmin_pitchScale = 1f;

	private int soundmin_count;

	private int soundmin_countmax = 10;

	private AudioSource[] soundmax = null;

	private string soundmax_pivotId = "";

	private float soundmax_pivotScale = 1f;

	private float soundmax_pitchBase = 0.1f;

	private float soundmax_pitchScale = 1f;

	private int soundmax_count;

	private int soundmax_countmax = 10;

	private AudioSource[] soundstall = null;

	private int soundstall_count;

	private int soundstall_countmax = 10;

	private bool iscrashed = false;

	private AudioSource[] soundcrash = null;

	private int soundcrash_count;

	private int soundcrash_countmax = 10;

	public string searchScreenCursorObjectName = "Screen cursor";

	public string searchScreenSpeedMeterObjectName = "Screen speed meter";

	public string searchScreenAutopilotMeterObjectName = "Screen autopilot meter";

	public string searchSceneObjectName = "Scene";

	public float searchSceneObjectGranularity = 1500f;

	public string searchGroundObjectName = "Scene ground";

	public float searchGroundObjectGranularity = 150f;

	public string searchCloudsObjectName = "Scene clouds";

	public float searchCloudsObjectGranularity = 1500f;

	public float searchCloudsWindSpeedMultiplier = 5f;

	private Vector3 worldup = Vector3.up;

	private Vector3 cameraposition = Vector3.zero;

	private Quaternion cameraorientation = Quaternion.identity;

	private bool camerafixed = false;

	private Vector3 cameralookat = Vector3.zero;

	private Vector3 cameraup = Vector3.up;

	private Vector3 cameraposition_filtered = Vector3.zero;

	private Vector3 cameralookat_filtered = Vector3.zero;

	private Vector3 cameraup_filtered = Vector3.up;

	private float camera_filter = 0.01f;

	private int scheduleRecoverVehicle = 0;

	private float gs_old = 0f;

	private float hgs_old = 0f;

	private float ProcessSounds_granularityPitch = 0.01f;

	private float ProcessSounds_granularityTime = 0.25f;

	private float ProcessSounds_granularityTime2 = 5.25f;

	private float ProcessSounds_granularityTimeRemaining = 0f;

	private float ProcessSounds_granularityTime2Remaining = 0f;

	public static Color skyboxRenderingColor0Default => new Color(0.41015625f, 0.41015625f, 0.41015625f, 1f);

	public static Color skyboxRenderingColor1Default => new Color(0.48828125f, 0.68359375f, 0.99609375f, 1f);

	public static Color skyboxRenderingColor2Default => new Color(0.19140625f, 0.30078125f, 0.47265625f, 1f);

	public static Color skyboxRenderingColor3Default => new Color(0f, 0f, 0f, 1f);

	public bool recoverVehicle()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: 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_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)sm != (Object)null)
		{
			sm.isCrashed = false;
			if (enableRecoverVehicleReset)
			{
				sm.placeAt(enableRecoverVehiclePosition, enableRecoverVehicleRotation, applySpeed: true, 0f * sm.globalSimulationScale, applyThrottle: true, 0f);
			}
			else if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
			{
				sm.placeAt(((Component)this).gameObject.transform.position + new Vector3(0f, 500f * sm.globalSimulationScale, 0f), new Vector3(-30f, ((Component)this).gameObject.transform.eulerAngles.y, 0f), 100f * sm.globalSimulationScale);
			}
			else
			{
				sm.placeAt(((Component)this).gameObject.transform.position + new Vector3(0f, 50f * sm.globalSimulationScale, 0f), new Vector3(-30f, ((Component)this).gameObject.transform.eulerAngles.y, 0f), 100f * sm.globalSimulationScale);
			}
			sm.ignore_check_simulation_broken();
		}
		return true;
	}

	private void FindNodes(GameObject e, int r)
	{
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Expected O, but got Unknown
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Expected O, but got Unknown
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a4: Expected O, but got Unknown
		for (int i = 0; i < e.transform.childCount; i++)
		{
			GameObject gameObject = ((Component)e.transform.GetChild(i)).gameObject;
			if (!gameObject.activeSelf)
			{
				continue;
			}
			if (searchSounds)
			{
				if (((Object)gameObject).name.Contains("_soundmin_") && soundmin_count < soundmin_countmax)
				{
					soundmin[soundmin_count] = (AudioSource)gameObject.GetComponent("AudioSource");
					if ((Object)(object)soundmin[soundmin_count] != (Object)null)
					{
						soundmin[soundmin_count].loop = true;
						soundmin[soundmin_count].volume = 0f;
						soundmin_pivotId = GAircraft.ReplaceStringIgnoreCase(((Object)gameObject).name, "pivotId", soundmin_pivotId);
						soundmin_pivotScale = GAircraft.ReplaceFloatIgnoreCase(((Object)gameObject).name, "pivotScale", soundmin_pivotScale);
						soundmin_pitchBase = GAircraft.ReplaceFloatIgnoreCase(((Object)gameObject).name, "pitchBase", soundmin_pitchBase);
						soundmin_pitchScale = GAircraft.ReplaceFloatIgnoreCase(((Object)gameObject).name, "pitchScale", soundmin_pitchScale);
						soundmin[soundmin_count].Play((ulong)Mathf.FloorToInt((float)soundmin_count * 1.7f * 44100f));
						soundmin_count++;
					}
				}
				if (((Object)gameObject).name.Contains("_soundmax_") && soundmax_count < soundmax_countmax)
				{
					soundmax[soundmax_count] = (AudioSource)gameObject.GetComponent("AudioSource");
					if ((Object)(object)soundmax[soundmax_count] != (Object)null)
					{
						soundmax[soundmax_count].loop = true;
						soundmax[soundmax_count].volume = 0f;
						soundmax_pivotId = GAircraft.ReplaceStringIgnoreCase(((Object)gameObject).name, "pivotId", soundmax_pivotId);
						soundmax_pivotScale = GAircraft.ReplaceFloatIgnoreCase(((Object)gameObject).name, "pivotScale", soundmax_pivotScale);
						soundmax_pitchBase = GAircraft.ReplaceFloatIgnoreCase(((Object)gameObject).name, "pitchBase", soundmax_pitchBase);
						soundmax_pitchScale = GAircraft.ReplaceFloatIgnoreCase(((Object)gameObject).name, "pitchScale", soundmax_pitchScale);
						soundmax[soundmax_count].Play((ulong)Mathf.FloorToInt((float)soundmax_count * 1.9f * 44100f));
						soundmax_count++;
					}
				}
				if (((Object)gameObject).name.Contains("_soundstall_") && soundstall_count < soundstall_countmax)
				{
					soundstall[soundstall_count] = (AudioSource)gameObject.GetComponent("AudioSource");
					if ((Object)(object)soundstall[soundstall_count] != (Object)null)
					{
						soundstall[soundstall_count].loop = true;
						soundstall[soundstall_count].volume = 0f;
						soundstall[soundstall_count].Play((ulong)Mathf.FloorToInt((float)soundstall_count * 1.9f * 44100f));
						soundstall_count++;
					}
				}
				if (((Object)gameObject).name.Contains("_soundcrash_") && soundcrash_count < soundcrash_countmax)
				{
					soundcrash[soundcrash_count] = (AudioSource)gameObject.GetComponent("AudioSource");
					if ((Object)(object)soundcrash[soundcrash_count] != (Object)null)
					{
						soundcrash[soundcrash_count].loop = false;
						soundcrash[soundcrash_count].volume = 0f;
						soundcrash_count++;
					}
				}
			}
			if (r < 10)
			{
				FindNodes(gameObject, r + 1);
			}
		}
	}

	private void Skybox_Start()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Expected O, but got Unknown
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Expected O, but got Unknown
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Expected O, but got Unknown
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Expected O, but got Unknown
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Expected O, but got Unknown
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Expected O, but got Unknown
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Expected O, but got Unknown
		if ((Object)(object)skyboxComponent == (Object)null)
		{
			skyboxComponent = (Skybox)((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).gameObject.GetComponent("Skybox");
		}
		if ((Object)(object)skyboxComponent == (Object)null)
		{
			((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).gameObject.AddComponent<Skybox>();
		}
		if ((Object)(object)skyboxComponent == (Object)null)
		{
			skyboxComponent = (Skybox)((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).gameObject.GetComponent("Skybox");
		}
		if (!((Object)(object)skyboxComponent != (Object)null))
		{
			return;
		}
		if ((Object)(object)skyboxMaterial == (Object)null)
		{
			skyboxMaterial = new Material(Shader.Find("RenderFX/Skybox"));
		}
		if ((Object)(object)skyboxMaterial != (Object)null)
		{
			int num = skyboxTextureWidth;
			int num2 = skyboxTextureHeight;
			if ((Object)(object)_FrontTex == (Object)null)
			{
				_FrontTex = new Texture2D(num, num2, (TextureFormat)5, false);
			}
			if ((Object)(object)_LeftTex == (Object)null)
			{
				_LeftTex = new Texture2D(num, num2, (TextureFormat)5, false);
			}
			if ((Object)(object)_RightTex == (Object)null)
			{
				_RightTex = new Texture2D(num, num2, (TextureFormat)5, false);
			}
			if ((Object)(object)_BackTex == (Object)null)
			{
				_BackTex = new Texture2D(num, num2, (TextureFormat)5, false);
			}
			if ((Object)(object)_UpTex == (Object)null)
			{
				_UpTex = new Texture2D(num, num2, (TextureFormat)5, false);
			}
			if ((Object)(object)_DownTex == (Object)null)
			{
				_DownTex = new Texture2D(num, num2, (TextureFormat)5, false);
			}
			((Texture)_FrontTex).wrapMode = (TextureWrapMode)1;
			((Texture)_LeftTex).wrapMode = (TextureWrapMode)1;
			((Texture)_RightTex).wrapMode = (TextureWrapMode)1;
			((Texture)_BackTex).wrapMode = (TextureWrapMode)1;
			((Texture)_UpTex).wrapMode = (TextureWrapMode)1;
			((Texture)_DownTex).wrapMode = (TextureWrapMode)1;
			skyboxMaterial.SetTexture("_FrontTex", (Texture)(object)_FrontTex);
			skyboxMaterial.SetTexture("_LeftTex", (Texture)(object)_LeftTex);
			skyboxMaterial.SetTexture("_RightTex", (Texture)(object)_RightTex);
			skyboxMaterial.SetTexture("_BackTex", (Texture)(object)_BackTex);
			skyboxMaterial.SetTexture("_UpTex", (Texture)(object)_UpTex);
			skyboxMaterial.SetTexture("_DownTex", (Texture)(object)_DownTex);
			if (pixels == null)
			{
				pixels = (Color32[])(object)new Color32[num * num2];
			}
			skyboxAngleColors = Mathf.FloorToInt(Mathf.Sqrt((float)(num * num + num2 * num2)) + (float)Mathf.Max(num, num2)) * 4 + 1;
			if (skyboxAngleColor == null)
			{
				skyboxAngleColor = (Color32[])(object)new Color32[skyboxAngleColors];
			}
			if (skyboxTopAngles == null)
			{
				skyboxTopAngles = new int[num, num2];
			}
			if (skyboxSideAngles == null)
			{
				skyboxSideAngles = new int[num, num2];
			}
			if (skyboxBottomAngles == null)
			{
				skyboxBottomAngles = new int[num, num2];
			}
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num2; j++)
				{
					float num6 = ((float)i - (float)num / 2f) * 2f / (float)num;
					float num7 = ((float)j - (float)num2 / 2f) * 2f / (float)num2;
					pixels[i + j * num].a = byte.MaxValue;
					num3 = Mathf.Atan(1f / Mathf.Sqrt(num6 * num6 + num7 * num7));
					skyboxTopAngles[i, j] = Mathf.RoundToInt((float)skyboxAngleColors * ((num3 + (float)Math.PI / 2f) / (float)Math.PI));
					if (skyboxTopAngles[i, j] < 0)
					{
						skyboxTopAngles[i, j] = 0;
					}
					if (skyboxTopAngles[i, j] >= skyboxAngleColors)
					{
						skyboxTopAngles[i, j] = skyboxAngleColors - 1;
					}
					num4 = Mathf.Atan(num7 / Mathf.Sqrt(1f + num6 * num6));
					skyboxSideAngles[i, j] = Mathf.RoundToInt((float)skyboxAngleColors * ((num4 + (float)Math.PI / 2f) / (float)Math.PI));
					if (skyboxSideAngles[i, j] < 0)
					{
						skyboxSideAngles[i, j] = 0;
					}
					if (skyboxSideAngles[i, j] >= skyboxAngleColors)
					{
						skyboxSideAngles[i, j] = skyboxAngleColors - 1;
					}
					num5 = Mathf.Atan(-1f / Mathf.Sqrt(num6 * num6 + num7 * num7));
					skyboxBottomAngles[i, j] = Mathf.RoundToInt((float)skyboxAngleColors * ((num5 + (float)Math.PI / 2f) / (float)Math.PI));
					if (skyboxBottomAngles[i, j] < 0)
					{
						skyboxBottomAngles[i, j] = 0;
					}
					if (skyboxBottomAngles[i, j] >= skyboxAngleColors)
					{
						skyboxBottomAngles[i, j] = skyboxAngleColors - 1;
					}
				}
			}
		}
		else
		{
			Debug.Log((object)"Failed to create material from shader RenderFX/Skybox");
		}
		skyboxComponent.material = skyboxMaterial;
	}

	private void Start()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Expected O, but got Unknown
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Invalid comparison between Unknown and I4
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Invalid comparison between Unknown and I4
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Invalid comparison between Unknown and I4
		if ((Object)(object)GameObject.Find(searchScreenCursorObjectName) != (Object)null)
		{
			crossair = (GUITexture)GameObject.Find(searchScreenCursorObjectName).GetComponent("GUITexture");
		}
		if ((Object)(object)GameObject.Find(searchScreenSpeedMeterObjectName) != (Object)null)
		{
			speedmeter = (GUIText)GameObject.Find(searchScreenSpeedMeterObjectName).GetComponent("GUIText");
		}
		if ((Object)(object)GameObject.Find(searchScreenAutopilotMeterObjectName) != (Object)null)
		{
			autopilotmeter = (GUIText)GameObject.Find(searchScreenAutopilotMeterObjectName).GetComponent("GUIText");
		}
		scene = GameObject.Find(searchSceneObjectName);
		ground = GameObject.Find(searchGroundObjectName);
		clouds = GameObject.Find(searchCloudsObjectName);
		cameraExternalEnabled_lastValue = !cameraExternalEnabled;
		if (searchSounds)
		{
			soundmin = (AudioSource[])(object)new AudioSource[soundmin_countmax];
			soundmax = (AudioSource[])(object)new AudioSource[soundmax_countmax];
			soundstall = (AudioSource[])(object)new AudioSource[soundstall_countmax];
			soundcrash = (AudioSource[])(object)new AudioSource[soundcrash_countmax];
			soundmin_count = 0;
			soundmax_count = 0;
			soundstall_count = 0;
			soundcrash_count = 0;
		}
		FindNodes(((Component)this).gameObject, 0);
		sm = (GAircraft)(object)((Component)this).gameObject.GetComponent("GAircraft");
		if (enableRecoverVehicle)
		{
			enableRecoverVehiclePosition = ((Component)sm).transform.position;
			enableRecoverVehicleRotation = ((Component)sm).transform.eulerAngles;
		}
		initialFogMode = RenderSettings.fogMode;
		FogMode val = initialFogMode;
		if ((int)val != 1)
		{
			if ((int)val == 2 || (int)val == 3)
			{
				initialFogValue = RenderSettings.fogDensity;
			}
		}
		else
		{
			initialFogValue = RenderSettings.fogEndDistance;
		}
		if (extremeFogValue < 0f)
		{
			extremeFogValue = initialFogValue;
		}
	}

	private void Update()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		if (globalSimulationScaleApplyToCamera && (Object)(object)sm != (Object)null)
		{
			globalSimulationScale = sm.globalSimulationScale;
		}
		if (Input.GetKeyUp(inputExternalCameraKeyForToggle))
		{
			inputExternalCameraKeyForToggled = true;
		}
		if (Input.GetKeyUp(inputFixedPositionCameraKeyForToggle))
		{
			inputFixedPositionCameraKeyForToggled = true;
		}
		if (Input.GetKeyUp(inputRecoverVehicleKeyForToggle))
		{
			inputRecoverVehicleKeyForToggled = true;
		}
		ProcessSkybox();
		if (GAircraft.isSimulationPaused)
		{
			ProcessSounds(Time.deltaTime);
		}
		else if (!cameraOnFixedUpdate)
		{
			ProcessCamera(Time.deltaTime);
		}
	}

	private void FixedUpdate()
	{
		if (globalSimulationScaleApplyToCamera && (Object)(object)sm != (Object)null)
		{
			globalSimulationScale = sm.globalSimulationScale;
		}
		if (!GAircraft.isSimulationPaused && cameraOnFixedUpdate)
		{
			ProcessCamera(Time.fixedDeltaTime);
		}
	}

	private bool getSkyboxRenderingColor(float height, bool renderSpace, out Color output)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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_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_007d: 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_0114: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		if (height < skyboxRenderingColor1Height)
		{
			output = skyboxRenderingColor1;
		}
		else if (height < skyboxRenderingColor2Height)
		{
			output = skyboxRenderingColor1 * (skyboxRenderingColor2Height - height) / (skyboxRenderingColor2Height - skyboxRenderingColor1Height) + skyboxRenderingColor2 * (height - skyboxRenderingColor1Height) / (skyboxRenderingColor2Height - skyboxRenderingColor1Height);
		}
		else if (renderSpace)
		{
			if (height < skyboxRenderingColor3Height)
			{
				output = skyboxRenderingColor2 * (skyboxRenderingColor3Height - height) / (skyboxRenderingColor3Height - skyboxRenderingColor2Height) + skyboxRenderingColor3 * (height - skyboxRenderingColor2Height) / (skyboxRenderingColor3Height - skyboxRenderingColor2Height);
			}
			else
			{
				output = skyboxRenderingColor3;
			}
		}
		else
		{
			output = skyboxRenderingColor2;
		}
		return true;
	}

	private bool PreProcessSkyboxTexture(float height)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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_0768: Unknown result type (might be due to invalid IL or missing references)
		//IL_076d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0772: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_0338: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a90: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
		//IL_071c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0721: Unknown result type (might be due to invalid IL or missing references)
		//IL_0726: Unknown result type (might be due to invalid IL or missing references)
		float num = 0f;
		int num2 = 0;
		float num3 = 0f;
		if (skyboxRenderingColor0Enabled)
		{
			tmp_skyboxRenderingColorm1 = skyboxRenderingColor0;
		}
		tmp_skyboxRenderingColor0 = skyboxRenderingColor;
		tmp_skyboxRenderingColor1 = skyboxRenderingColor1;
		tmp_skyboxRenderingColor2 = skyboxRenderingColor2;
		tmp_skyboxRenderingColor3 = skyboxRenderingColor3;
		tmp_skyboxRenderingColor4 = skyboxRenderingColorTop;
		if (height + skyboxRenderingColorTopDeltaHeight < skyboxRenderingColor3Height)
		{
			tmp_skyboxRenderingColor3 = skyboxRenderingColorTop;
		}
		if (height + skyboxRenderingColorTopDeltaHeight < skyboxRenderingColor2Height)
		{
			tmp_skyboxRenderingColor2 = skyboxRenderingColorTop;
		}
		if (height + skyboxRenderingColorTopDeltaHeight < skyboxRenderingColor1Height)
		{
			tmp_skyboxRenderingColor1 = skyboxRenderingColorTop;
		}
		if (skyboxRenderingColor0Enabled)
		{
			num = ((!(skyboxRenderingColor0Height - height > 0f)) ? Mathf.Atan((skyboxRenderingColor0Height - height) / skyboxRenderingColor0Distance) : Mathf.Atan((skyboxRenderingColor0Height - height) / skyboxRenderingColor0Distance));
		}
		float num4 = ((!(skyboxRenderingColor1Height - height > 0f)) ? Mathf.Atan((skyboxRenderingColor1Height - height) / skyboxRenderingColorDownwardsScatteringDistance) : Mathf.Atan((skyboxRenderingColor1Height - height) / skyboxRenderingColorUpwardsScatteringDistance));
		float num5 = ((!(skyboxRenderingColor2Height - height > 0f)) ? Mathf.Atan((skyboxRenderingColor2Height - height) / skyboxRenderingColorDownwardsScatteringDistance) : Mathf.Atan((skyboxRenderingColor2Height - height) / skyboxRenderingColorUpwardsScatteringDistance));
		float num6 = ((!(skyboxRenderingColor3Height - height > 0f)) ? Mathf.Atan((skyboxRenderingColor3Height - height) / skyboxRenderingColorDownwardsScatteringDistance) : Mathf.Atan((skyboxRenderingColor3Height - height) / skyboxRenderingColorUpwardsScatteringDistance));
		if (skyboxRenderingColor0Enabled)
		{
			num2 = Mathf.RoundToInt((float)skyboxAngleColors * ((num + (float)Math.PI / 2f) / (float)Math.PI));
		}
		int num7 = Mathf.RoundToInt((float)skyboxAngleColors * ((num4 + (float)Math.PI / 2f) / (float)Math.PI));
		int num8 = Mathf.RoundToInt((float)skyboxAngleColors * ((num5 + (float)Math.PI / 2f) / (float)Math.PI));
		int num9 = Mathf.RoundToInt((float)skyboxAngleColors * ((num6 + (float)Math.PI / 2f) / (float)Math.PI));
		int num10 = num7;
		int num11 = num9;
		if (skyboxRenderingColor0Enabled && num10 < num2 + 4)
		{
			num10 = num2 + 4;
		}
		if (num7 < num10 + 4)
		{
			num7 = num10 + 4;
		}
		if (num8 < num7 + 4)
		{
			num8 = num7 + 4;
		}
		if (num9 < num8 + 4)
		{
			num9 = num8 + 4;
		}
		if (num11 < num9 + 4)
		{
			num11 = num9 + 4;
		}
		if (skyboxRenderingColor0Enabled)
		{
			num3 = 255f / (float)(num10 - num2);
		}
		float num12 = 255f / (float)(num7 - num10);
		float num13 = 255f / (float)(num8 - num7);
		float num14 = 255f / (float)(num9 - num8);
		float num15 = 255f / (float)(num11 - num9);
		if (skyboxRenderingColor0Enabled)
		{
			for (int i = 0; i < skyboxAngleColors; i++)
			{
				if (i < num2)
				{
					ref Color32 reference = ref skyboxAngleColor[i];
					reference = Color32.op_Implicit(tmp_skyboxRenderingColorm1);
				}
				else if (i < num10)
				{
					skyboxAngleColor[i].r = (byte)((tmp_skyboxRenderingColor0.r * (float)(i - num2) + tmp_skyboxRenderingColorm1.r * (float)(num10 - i)) * num3);
					skyboxAngleColor[i].g = (byte)((tmp_skyboxRenderingColor0.g * (float)(i - num2) + tmp_skyboxRenderingColorm1.g * (float)(num10 - i)) * num3);
					skyboxAngleColor[i].b = (byte)((tmp_skyboxRenderingColor0.b * (float)(i - num2) + tmp_skyboxRenderingColorm1.b * (float)(num10 - i)) * num3);
				}
				else if (i < num7)
				{
					skyboxAngleColor[i].r = (byte)((tmp_skyboxRenderingColor1.r * (float)(i - num10) + tmp_skyboxRenderingColor0.r * (float)(num7 - i)) * num12);
					skyboxAngleColor[i].g = (byte)((tmp_skyboxRenderingColor1.g * (float)(i - num10) + tmp_skyboxRenderingColor0.g * (float)(num7 - i)) * num12);
					skyboxAngleColor[i].b = (byte)((tmp_skyboxRenderingColor1.b * (float)(i - num10) + tmp_skyboxRenderingColor0.b * (float)(num7 - i)) * num12);
				}
				else if (i < num8)
				{
					skyboxAngleColor[i].r = (byte)((tmp_skyboxRenderingColor2.r * (float)(i - num7) + tmp_skyboxRenderingColor1.r * (float)(num8 - i)) * num13);
					skyboxAngleColor[i].g = (byte)((tmp_skyboxRenderingColor2.g * (float)(i - num7) + tmp_skyboxRenderingColor1.g * (float)(num8 - i)) * num13);
					skyboxAngleColor[i].b = (byte)((tmp_skyboxRenderingColor2.b * (float)(i - num7) + tmp_skyboxRenderingColor1.b * (float)(num8 - i)) * num13);
				}
				else if (i < num9)
				{
					skyboxAngleColor[i].r = (byte)((tmp_skyboxRenderingColor3.r * (float)(i - num8) + tmp_skyboxRenderingColor2.r * (float)(num9 - i)) * num14);
					skyboxAngleColor[i].g = (byte)((tmp_skyboxRenderingColor3.g * (float)(i - num8) + tmp_skyboxRenderingColor2.g * (float)(num9 - i)) * num14);
					skyboxAngleColor[i].b = (byte)((tmp_skyboxRenderingColor3.b * (float)(i - num8) + tmp_skyboxRenderingColor2.b * (float)(num9 - i)) * num14);
				}
				else if (i < num11)
				{
					skyboxAngleColor[i].r = (byte)((tmp_skyboxRenderingColor4.r * (float)(i - num9) + tmp_skyboxRenderingColor3.r * (float)(num11 - i)) * num15);
					skyboxAngleColor[i].g = (byte)((tmp_skyboxRenderingColor4.g * (float)(i - num9) + tmp_skyboxRenderingColor3.g * (float)(num11 - i)) * num15);
					skyboxAngleColor[i].b = (byte)((tmp_skyboxRenderingColor4.b * (float)(i - num9) + tmp_skyboxRenderingColor3.b * (float)(num11 - i)) * num15);
				}
				else
				{
					ref Color32 reference2 = ref skyboxAngleColor[i];
					reference2 = Color32.op_Implicit(tmp_skyboxRenderingColor4);
				}
			}
		}
		else
		{
			for (int j = 0; j < skyboxAngleColors; j++)
			{
				if (j < num10)
				{
					ref Color32 reference3 = ref skyboxAngleColor[j];
					reference3 = Color32.op_Implicit(tmp_skyboxRenderingColor0);
				}
				else if (j < num7)
				{
					skyboxAngleColor[j].r = (byte)((tmp_skyboxRenderingColor1.r * (float)(j - num10) + tmp_skyboxRenderingColor0.r * (float)(num7 - j)) * num12);
					skyboxAngleColor[j].g = (byte)((tmp_skyboxRenderingColor1.g * (float)(j - num10) + tmp_skyboxRenderingColor0.g * (float)(num7 - j)) * num12);
					skyboxAngleColor[j].b = (byte)((tmp_skyboxRenderingColor1.b * (float)(j - num10) + tmp_skyboxRenderingColor0.b * (float)(num7 - j)) * num12);
				}
				else if (j < num8)
				{
					skyboxAngleColor[j].r = (byte)((tmp_skyboxRenderingColor2.r * (float)(j - num7) + tmp_skyboxRenderingColor1.r * (float)(num8 - j)) * num13);
					skyboxAngleColor[j].g = (byte)((tmp_skyboxRenderingColor2.g * (float)(j - num7) + tmp_skyboxRenderingColor1.g * (float)(num8 - j)) * num13);
					skyboxAngleColor[j].b = (byte)((tmp_skyboxRenderingColor2.b * (float)(j - num7) + tmp_skyboxRenderingColor1.b * (float)(num8 - j)) * num13);
				}
				else if (j < num9)
				{
					skyboxAngleColor[j].r = (byte)((tmp_skyboxRenderingColor3.r * (float)(j - num8) + tmp_skyboxRenderingColor2.r * (float)(num9 - j)) * num14);
					skyboxAngleColor[j].g = (byte)((tmp_skyboxRenderingColor3.g * (float)(j - num8) + tmp_skyboxRenderingColor2.g * (float)(num9 - j)) * num14);
					skyboxAngleColor[j].b = (byte)((tmp_skyboxRenderingColor3.b * (float)(j - num8) + tmp_skyboxRenderingColor2.b * (float)(num9 - j)) * num14);
				}
				else if (j < num11)
				{
					skyboxAngleColor[j].r = (byte)((tmp_skyboxRenderingColor4.r * (float)(j - num9) + tmp_skyboxRenderingColor3.r * (float)(num11 - j)) * num15);
					skyboxAngleColor[j].g = (byte)((tmp_skyboxRenderingColor4.g * (float)(j - num9) + tmp_skyboxRenderingColor3.g * (float)(num11 - j)) * num15);
					skyboxAngleColor[j].b = (byte)((tmp_skyboxRenderingColor4.b * (float)(j - num9) + tmp_skyboxRenderingColor3.b * (float)(num11 - j)) * num15);
				}
				else
				{
					ref Color32 reference4 = ref skyboxAngleColor[j];
					reference4 = Color32.op_Implicit(tmp_skyboxRenderingColor4);
				}
			}
		}
		return true;
	}

	private bool ProcessSkyboxTexture(Texture2D tex, float height, int mode)
	{
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		if (pixels == null)
		{
			Skybox_Start();
		}
		int width = ((Texture)tex).width;
		int height2 = ((Texture)tex).height;
		for (int i = 0; i < height2; i++)
		{
			switch (mode)
			{
			case -1:
			{
				for (int k = 0; k < width; k++)
				{
					ref Color32 reference2 = ref pixels[k + i * width];
					reference2 = skyboxAngleColor[skyboxBottomAngles[k, i]];
				}
				break;
			}
			case 0:
			{
				for (int l = 0; l < width; l++)
				{
					ref Color32 reference3 = ref pixels[l + i * width];
					reference3 = skyboxAngleColor[skyboxSideAngles[l, i]];
				}
				break;
			}
			case 1:
			{
				for (int j = 0; j < width; j++)
				{
					ref Color32 reference = ref pixels[j + i * width];
					reference = skyboxAngleColor[skyboxTopAngles[j, i]];
				}
				break;
			}
			}
		}
		tex.SetPixels32(pixels);
		tex.Apply(false);
		return true;
	}

	private void ProcessSkybox()
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Invalid comparison between Unknown and I4
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Invalid comparison between Unknown and I4
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Invalid comparison between Unknown and I4
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		float num = ((!((Object)(object)sm != (Object)null)) ? 0f : sm.height);
		if (fogRenderingEnabled)
		{
			if (skyboxRenderingColor0Enabled)
			{
				RenderSettings.fogColor = skyboxRenderingColor0;
			}
			else
			{
				RenderSettings.fogColor = skyboxRenderingColor;
			}
			FogMode val = initialFogMode;
			if ((int)val != 1)
			{
				if ((int)val == 2 || (int)val == 3)
				{
					RenderSettings.fogDensity = initialFogValue * (1f - fog01) + extremeFogValue * fog01;
				}
			}
			else
			{
				RenderSettings.fogEndDistance = initialFogValue * (1f - fog01) + extremeFogValue * fog01;
			}
		}
		if (!skyboxRenderingEnabled)
		{
			return;
		}
		if ((Object)(object)skyboxComponent == (Object)null)
		{
			Skybox_Start();
		}
		((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).clearFlags = (CameraClearFlags)1;
		getSkyboxRenderingColor(((Component)this).gameObject.transform.position.y + ((!((Object)(object)sm != (Object)null)) ? 0f : sm.height), renderSpace: false, out skyboxRenderingColor);
		((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).backgroundColor = skyboxRenderingColor;
		skyboxRenderNth_count--;
		if (skyboxRenderNth_count > 0)
		{
			return;
		}
		skyboxRenderNth_count = skyboxRenderNth;
		getSkyboxRenderingColor(((Component)this).gameObject.transform.position.y + num + skyboxRenderingColorTopDeltaHeight, renderSpace: true, out skyboxRenderingColorTop);
		PreProcessSkyboxTexture(((Component)this).gameObject.transform.position.y + num);
		for (int i = 0; i < skyboxRenderSidesPerNth; i++)
		{
			skyboxRenderNth_tex++;
			if (skyboxRenderNth_tex > 5)
			{
				skyboxRenderNth_tex = 0;
			}
			switch (skyboxRenderNth_tex)
			{
			case 0:
				if ((Object)(object)_FrontTex != (Object)null)
				{
					ProcessSkyboxTexture(_FrontTex, ((Component)this).gameObject.transform.position.y + num, 0);
				}
				break;
			case 1:
				if ((Object)(object)_LeftTex != (Object)null)
				{
					ProcessSkyboxTexture(_LeftTex, ((Component)this).gameObject.transform.position.y + num, 0);
				}
				break;
			case 2:
				if ((Object)(object)_RightTex != (Object)null)
				{
					ProcessSkyboxTexture(_RightTex, ((Component)this).gameObject.transform.position.y + num, 0);
				}
				break;
			case 3:
				if ((Object)(object)_BackTex != (Object)null)
				{
					ProcessSkyboxTexture(_BackTex, ((Component)this).gameObject.transform.position.y + num, 0);
				}
				break;
			case 4:
				if ((Object)(object)_UpTex != (Object)null)
				{
					ProcessSkyboxTexture(_UpTex, ((Component)this).gameObject.transform.position.y + num, 1);
				}
				break;
			case 5:
				if ((Object)(object)_DownTex != (Object)null)
				{
					ProcessSkyboxTexture(_DownTex, ((Component)this).gameObject.transform.position.y + num, -1);
				}
				break;
			}
		}
	}

	private void ProcessCamera(float timeLapsus)
	{
		//IL_000d: 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_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: 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_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04de: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0624: Unknown result type (might be due to invalid IL or missing references)
		//IL_0629: Unknown result type (might be due to invalid IL or missing references)
		//IL_0647: Unknown result type (might be due to invalid IL or missing references)
		//IL_064c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0940: Unknown result type (might be due to invalid IL or missing references)
		//IL_0945: Unknown result type (might be due to invalid IL or missing references)
		//IL_097e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0983: Unknown result type (might be due to invalid IL or missing references)
		//IL_07df: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0701: Unknown result type (might be due to invalid IL or missing references)
		//IL_0706: Unknown result type (might be due to invalid IL or missing references)
		//IL_0721: Unknown result type (might be due to invalid IL or missing references)
		//IL_0726: Unknown result type (might be due to invalid IL or missing references)
		//IL_076a: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_078a: Unknown result type (might be due to invalid IL or missing references)
		//IL_078f: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_080e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0813: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b1d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b22: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a90: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ace: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ade: 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_0af0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0afa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a26: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2b: Unknown result type (might be due to invalid IL or missing references)
		//IL_10e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_10f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_10ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_110a: Unknown result type (might be due to invalid IL or missing references)
		//IL_110f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1114: Unknown result type (might be due to invalid IL or missing references)
		//IL_111b: Unknown result type (might be due to invalid IL or missing references)
		//IL_112c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1132: Unknown result type (might be due to invalid IL or missing references)
		//IL_113d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1142: Unknown result type (might be due to invalid IL or missing references)
		//IL_1147: Unknown result type (might be due to invalid IL or missing references)
		//IL_114e: Unknown result type (might be due to invalid IL or missing references)
		//IL_115f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1165: Unknown result type (might be due to invalid IL or missing references)
		//IL_1170: Unknown result type (might be due to invalid IL or missing references)
		//IL_1175: Unknown result type (might be due to invalid IL or missing references)
		//IL_117a: Unknown result type (might be due to invalid IL or missing references)
		//IL_107b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1080: Unknown result type (might be due to invalid IL or missing references)
		//IL_11a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_10b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_10c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_10cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_10d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_10d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_10db: Unknown result type (might be due to invalid IL or missing references)
		//IL_11d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_11dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d4f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d5f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0da2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0da7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db1: Unknown result type (might be due to invalid IL or missing references)
		//IL_13a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_13a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_13c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_13c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_13ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ed3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ed9: 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_0f21: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f26: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f2b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e95: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e9b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eaa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eaf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ec0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ec5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1434: Unknown result type (might be due to invalid IL or missing references)
		//IL_1224: Unknown result type (might be due to invalid IL or missing references)
		//IL_1229: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e37: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e3c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e20: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dce: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dd9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0de9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dfa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e04: Unknown result type (might be due to invalid IL or missing references)
		//IL_1913: Unknown result type (might be due to invalid IL or missing references)
		//IL_15a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_15a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_15f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_15f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_1237: Unknown result type (might be due to invalid IL or missing references)
		//IL_1239: Unknown result type (might be due to invalid IL or missing references)
		//IL_1244: Unknown result type (might be due to invalid IL or missing references)
		//IL_1249: Unknown result type (might be due to invalid IL or missing references)
		//IL_124e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1253: Unknown result type (might be due to invalid IL or missing references)
		//IL_1260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fb1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fb6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f95: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f9a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f48: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f53: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f63: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f74: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f79: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f7e: Unknown result type (might be due to invalid IL or missing references)
		//IL_127e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e4f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e5f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e66: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e71: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e76: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1666: Unknown result type (might be due to invalid IL or missing references)
		//IL_166b: Unknown result type (might be due to invalid IL or missing references)
		//IL_12a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_12ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_12db: Unknown result type (might be due to invalid IL or missing references)
		//IL_12e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fd9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fe0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0feb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ff0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ff5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1373: Unknown result type (might be due to invalid IL or missing references)
		//IL_1723: Unknown result type (might be due to invalid IL or missing references)
		//IL_1728: Unknown result type (might be due to invalid IL or missing references)
		//IL_172d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1780: Unknown result type (might be due to invalid IL or missing references)
		//IL_1785: Unknown result type (might be due to invalid IL or missing references)
		//IL_178a: Unknown result type (might be due to invalid IL or missing references)
		if (enableSpecialForce && Input.GetKey(specialForceApplyZeroRotate))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
		}
		if (scheduleRecoverVehicle > 0)
		{
			scheduleRecoverVehicle--;
			if (scheduleRecoverVehicle == 0)
			{
				recoverVehicle();
			}
		}
		if (enableRecoverVehicle && inputRecoverVehicleKeyForToggled)
		{
			inputRecoverVehicleKeyForToggled = false;
			recoverVehicle();
		}
		if (cameraOnFixedUpdate_count > 0)
		{
			cameraOnFixedUpdate_count--;
		}
		else if (inputExternalCameraKeyForToggled)
		{
			inputExternalCameraKeyForToggled = false;
			if (cameraExternalEnabled)
			{
				cameraExternalEnabled = false;
				if ((Object)(object)sm != (Object)null && sm.globalDebugNodes)
				{
					Debug.Log((object)("Internal Camera " + currentCameraPosition + " Selected"));
				}
			}
			else
			{
				currentCameraPosition++;
				if (currentCameraPosition >= countCameraPositions)
				{
					currentCameraPosition = 0;
					cameraExternalEnabled = true;
					if ((Object)(object)sm != (Object)null && sm.globalDebugNodes)
					{
						Debug.Log((object)"External Camera Selected");
					}
				}
				else if ((Object)(object)sm != (Object)null && sm.globalDebugNodes)
				{
					Debug.Log((object)("Internal Camera " + currentCameraPosition + " Selected"));
				}
			}
			cameraOnFixedUpdate_count = 50;
		}
		if (inputFixedPositionCameraKeyForToggled)
		{
			inputFixedPositionCameraKeyForToggled = false;
			cameraFixedPositionEnabled = !cameraFixedPositionEnabled;
			if (cameraFixedPositionEnabled)
			{
				cameraposition += ((Component)this).gameObject.GetComponent<Rigidbody>().velocity * 4f;
			}
		}
		if (enableSpecialForce && Input.GetKey(specialForceApplyLeft))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().AddForce(-((Component)this).gameObject.transform.right * specialForceMagnitude);
		}
		if (enableSpecialForce && Input.GetKey(specialForceApplyRight))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().AddForce(((Component)this).gameObject.transform.right * specialForceMagnitude);
		}
		if (enableSpecialForce && Input.GetKey(specialForceApplyForward))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().AddForce(((Component)this).gameObject.transform.forward * specialForceMagnitude);
		}
		if (enableSpecialForce && Input.GetKey(specialForceApplyForceBack))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().AddForce(-((Component)this).gameObject.transform.forward * specialForceMagnitude);
		}
		if (enableSpecialForce && Input.GetKey(specialForceApplyForceUp))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().AddForce(((Component)this).gameObject.transform.up * specialForceMagnitude);
		}
		if (enableSpecialForce && Input.GetKey(specialForceApplyDown))
		{
			((Component)this).gameObject.GetComponent<Rigidbody>().AddForce(-((Component)this).gameObject.transform.up * specialForceMagnitude);
		}
		if (cameraExternalEnabled != cameraExternalEnabled_lastValue)
		{
			if (cameraExternalEnabled)
			{
				((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).nearClipPlane = cameraExternalNearClipPlane * globalSimulationScale;
				((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).farClipPlane = cameraExternalFarClipPlane * globalSimulationScale;
			}
			else
			{
				((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).nearClipPlane = cameraInternalNearClipPlane * globalSimulationScale;
				((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).farClipPlane = cameraInternalFarClipPlane * globalSimulationScale;
			}
			cameraExternalEnabled_lastValue = cameraExternalEnabled;
		}
		float num = (Input.mousePosition.x - (float)Screen.width / 2f) / (float)Screen.width;
		float num2 = (Input.mousePosition.y - (float)Screen.height / 2f) / (float)Screen.height;
		if (num > 0.5f)
		{
			num = 0.5f;
		}
		if (num < -0.5f)
		{
			num = -0.5f;
		}
		if (num2 > 0.5f)
		{
			num2 = 0.5f;
		}
		if (num2 < -0.5f)
		{
			num2 = -0.5f;
		}
		float num3 = gs_old * (1f - cameraInternalGsMixing) + sm.gaugesGs_output * cameraInternalGsMixing;
		if (num3 > cameraInternalGsMax)
		{
			num3 = cameraInternalGsMax;
		}
		if (num3 < 0f - cameraInternalGsMax)
		{
			num3 = 0f - cameraInternalGsMax;
		}
		gs_old = num3;
		float num4 = hgs_old * (1f - cameraInternalGsMixing) + sm.gaugesHGs_output * cameraInternalGsMixing;
		if (num4 > cameraInternalGsMax)
		{
			num4 = cameraInternalGsMax;
		}
		if (num4 < 0f - cameraInternalGsMax)
		{
			num4 = 0f - cameraInternalGsMax;
		}
		hgs_old = num4;
		Vector3 position = ((Component)this).gameObject.transform.position;
		if ((Object)(object)cameraAlternateFollow != (Object)null)
		{
			position = cameraAlternateFollow.transform.position;
		}
		if (cameraExternalEnabled)
		{
			if (Input.GetAxis("Mouse ScrollWheel") > 0f && cameraExternalDistance > cameraExternalDistanceMin)
			{
				cameraExternalDistance -= cameraExternalDistanceStep * inputWheelMouseSensivity / 10f;
			}
			if (Input.GetAxis("Mouse ScrollWheel") < 0f && cameraExternalDistance < cameraExternalDistanceMax)
			{
				cameraExternalDistance += cameraExternalDistanceStep * inputWheelMouseSensivity / 10f;
			}
			if (!cameraFixedPositionEnabled)
			{
				cameraposition = position + new Vector3((0f - ((Component)this).gameObject.transform.forward.x) * 20f - ((Component)this).gameObject.transform.right.x * 40f * num * inputHorizontalMouseSensivity / 3f, -40f * (num2 * inputVerticalMouseSensivity / 3f - 0.25f), (0f - ((Component)this).gameObject.transform.forward.z) * 20f - ((Component)this).gameObject.transform.right.z * 40f * num * inputHorizontalMouseSensivity / 3f) * cameraExternalDistance * cameraExternalMinHeightScale * globalSimulationScale;
			}
			cameralookat = position;
			if (cameraExternalUpWorld)
			{
				cameraup = worldup;
			}
			else
			{
				cameraup = ((Component)this).gameObject.transform.up;
			}
			if (cameraFixedPositionEnabled)
			{
				((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).fieldOfView = 20f;
			}
			else
			{
				((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).fieldOfView = 80f;
			}
			camera_filter = cameraExternalFilter;
			cameraOnFixedUpdate = true;
		}
		else
		{
			if (Input.GetAxis("Mouse ScrollWheel") > 0f && cameraInternalFov > cameraInternalFovMin)
			{
				cameraInternalFov -= cameraInternalFovStep * inputWheelMouseSensivity * cameraInternalSensivity / 10f;
			}
			if (Input.GetAxis("Mouse ScrollWheel") < 0f && cameraInternalFov < cameraInternalFovMax)
			{
				cameraInternalFov += cameraInternalFovStep * inputWheelMouseSensivity * cameraInternalSensivity / 10f;
			}
			cameraorientation = ((Component)this).gameObject.transform.rotation;
			camerafixed = false;
			countCameraPositions = 0;
			if (!cameraFixedPositionEnabled)
			{
				cameraposition = ((Component)this).gameObject.transform.TransformPoint(0f, 0.4f, -0.4f);
			}
			if (!cameraFixedPositionEnabled && (Object)(object)sm != (Object)null && sm.labeled_surfacemisc != null)
			{
				for (int i = 0; i < sm.labeled_surfacemisc_count; i++)
				{
					if (sm.labeled_surfacemisc[i].cameraPosition)
					{
						if (currentCameraPosition == countCameraPositions)
						{
							cameraposition = sm.labeled_surfacemisc[i].gameObject.transform.position;
							cameraorientation = sm.labeled_surfacemisc[i].gameObject.transform.rotation;
							camerafixed = !sm.labeled_surfacemisc[i].cameraCanRotate;
						}
						countCameraPositions++;
					}
				}
			}
			if (!camerafixed)
			{
				if (cameraInternalGsPosition)
				{
					cameraposition -= ((Component)this).gameObject.transform.up * num3 * cameraInternalGsPositionDelta;
				}
				if (cameraInternalGsPosition)
				{
					cameraposition -= ((Component)this).gameObject.transform.right * num4 * cameraInternalGsPositionHDelta;
				}
			}
			if ((Object)(object)cameraAlternateFollow != (Object)null)
			{
				cameraposition = cameraAlternateFollow.transform.position;
			}
			float num5 = ((cameraInternalDontVertical && cameraInternalDontVerticalMix) ? ((!cameraInternalGsRotation) ? (0f - Mathf.Sin((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity * (1f - cameraInternalDontVerticalMixing))) : (0f - Mathf.Sin((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity * (1f - cameraInternalDontVerticalMixing) + num3 * cameraInternalGsRotationDelta))) : (cameraInternalDontVertical ? ((!cameraInternalGsRotation) ? (0f - Mathf.Sin(0f)) : (0f - Mathf.Sin(num3 * cameraInternalGsRotationDelta))) : ((!cameraInternalGsRotation) ? (0f - Mathf.Sin((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity)) : (0f - Mathf.Sin((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity + num3 * cameraInternalGsRotationDelta)))));
			float num6 = ((cameraInternalDontVertical && cameraInternalDontVerticalMix) ? ((!cameraInternalGsRotation) ? Mathf.Cos((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity * (1f - cameraInternalDontVerticalMixing)) : Mathf.Cos((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity * (1f - cameraInternalDontVerticalMixing) + num3 * cameraInternalGsRotationDelta)) : (cameraInternalDontVertical ? ((!cameraInternalGsRotation) ? Mathf.Cos(0f) : Mathf.Cos(num3 * cameraInternalGsRotationDelta)) : ((!cameraInternalGsRotation) ? Mathf.Cos((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity) : Mathf.Cos((0f - num2) * inputVerticalMouseSensivity * cameraInternalSensivity + num3 * cameraInternalGsRotationDelta))));
			if ((Object)(object)cameraAlternateFollow != (Object)null)
			{
				cameralookat = cameraposition + cameraAlternateFollow.transform.rotation * new Vector3((0f - Mathf.Cos(-(float)Math.PI / 2f - num * inputHorizontalMouseSensivity * cameraInternalSensivity)) * num6, num5, (0f - Mathf.Sin(-(float)Math.PI / 2f - num * inputHorizontalMouseSensivity * cameraInternalSensivity)) * num6);
				if (cameraInternalUpWorld && cameraInternalUpWorldMix)
				{
					cameraup = worldup * cameraInternalUpWorldMixing + cameraAlternateFollow.transform.up * (1f - cameraInternalUpWorldMixing);
				}
				else if (cameraInternalUpWorld)
				{
					cameraup = worldup;
				}
				else
				{
					cameraup = cameraAlternateFollow.transform.up;
				}
				if (cameraInternalGsRotation)
				{
					cameraup -= cameraAlternateFollow.transform.right * num4 * cameraInternalGsRotationDelta;
				}
			}
			else if (camerafixed)
			{
				cameralookat = cameraposition + cameraorientation * Vector3.forward;
				cameraup = ((Component)this).gameObject.transform.up;
			}
			else
			{
				cameralookat = cameraposition + cameraorientation * new Vector3((0f - Mathf.Cos(-(float)Math.PI / 2f - num * inputHorizontalMouseSensivity * cameraInternalSensivity)) * num6, num5, (0f - Mathf.Sin(-(float)Math.PI / 2f - num * inputHorizontalMouseSensivity * cameraInternalSensivity)) * num6);
				if (cameraInternalUpWorld && cameraInternalUpWorldMix)
				{
					cameraup = worldup * cameraInternalUpWorldMixing + ((Component)this).gameObject.transform.up * (1f - cameraInternalUpWorldMixing);
				}
				else if (cameraInternalUpWorld)
				{
					cameraup = worldup;
				}
				else
				{
					cameraup = ((Component)this).gameObject.transform.up;
				}
				if (cameraInternalGsRotation)
				{
					cameraup -= ((Component)this).gameObject.transform.right * num4 * cameraInternalGsRotationDelta;
				}
			}
			((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main).fieldOfView = cameraInternalFov;
			camera_filter = cameraInternalFilter;
			cameraOnFixedUpdate = false;
		}
		if (sunlightAttach && (Object)(object)sunlight != (Object)null)
		{
			((Component)sunlight).transform.position = (1f - sunlightAttachFilter) * ((Component)sunlight).transform.position + sunlightAttachFilter * (((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).transform.position - ((Component)sunlight).transform.forward * sunlightAttachDistance);
		}
		cameraposition_filtered = cameraposition_filtered * (1f - camera_filter) + cameraposition * camera_filter;
		cameralookat_filtered = cameralookat_filtered * (1f - camera_filter) + cameralookat * camera_filter;
		cameraup_filtered = cameraup_filtered * (1f - camera_filter) + cameraup * camera_filter;
		((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).transform.position = cameraposition_filtered;
		((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).transform.LookAt(cameralookat_filtered, cameraup_filtered);
		cameraExternalMinHeightScale = 1f;
		if (cameraExternalEnabled)
		{
			Vector3 position2 = ((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).transform.position;
			RaycastHit val = default(RaycastHit);
			if (cameraExternalMinHeightAutoProbe && Physics.Raycast(position2 + Vector3.up * cameraExternalMinHeightAutoProbeDeltaProbe, -Vector3.up, ref val, 1E+09f, LayerMask.op_Implicit(cameraExternalMinHeightAutoProbeLayermask)) && position2.y < ((RaycastHit)(ref val)).point.y + cameraExternalMinHeightAutoProbeDelta)
			{
				cameraExternalMinHeightScale *= 1f / ((((RaycastHit)(ref val)).point.y + cameraExternalMinHeightAutoProbeDelta - position2.y) * 0.1f + 1f);
				position2.y = ((RaycastHit)(ref val)).point.y + cameraExternalMinHeightAutoProbeDelta * cameraExternalMinHeightScale;
			}
			if (position2.y < cameraExternalMinHeight)
			{
				cameraExternalMinHeightScale *= 1f / ((cameraExternalMinHeight - position2.y) * 1f + 1f);
				position2.y = cameraExternalMinHeight;
			}
			((Component)((!((Object)(object)attachToCamera == (Object)null)) ? attachToCamera : Camera.main)).transform.position = position2;
		}
		if ((Object)(object)crossair != (Object)null)
		{
			Cursor.visible = false;
			float num7 = 64f;
			crossair.pixelInset = new Rect(Input.mousePosition.x - (float)Screen.width / 2f - num7 / 2f, Input.mousePosition.y - (float)Screen.height / 2f - num7 / 2f, num7, num7);
		}
		if ((Object)(object)speedmeter != (Object)null)
		{
			speedmeter.pixelOffset = new Vector2((float)(-Screen.width) / 2f + 10f, (float)Screen.height / 2f - 10f);
			float num8 = 15f;
			float num9 = 331.3f + 0.606f * num8;
			if ((Object)(object)sm != (Object)null)
			{
				GUIText obj = speedmeter;
				string[] obj2 = new string[28]
				{
					"speed: ",
					(Mathf.Floor(sm.speed / sm.globalSimulationScale * 3.6f * 100f) / 100f).ToString(),
					" km/h | ",
					(Mathf.Floor(sm.speed / sm.globalSimulationScale * 1.9438444f * 100f) / 100f).ToString(),
					" knots | M",
					(Mathf.Floor(sm.speed / sm.globalSimulationScale / num9 * 100f) / 100f).ToString(),
					" | ",
					(Mathf.Floor(sm.speed / sm.globalSimulationScale * 100f) / 100f).ToString(),
					" m/s | alternate method: ",
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null
				};
				Vector3 velocity = ((Component)this).gameObject.GetComponent<Rigidbody>().velocity;
				obj2[9] = (Mathf.Floor(((Vector3)(ref velocity)).magnitude / sm.globalSimulationScale * 100f) / 100f).ToString();
				obj2[10] = " m/s\nheight ";
				obj2[11] = (Mathf.Floor(((Component)this).gameObject.transform.position.y + ((!((Object)(object)sm != (Object)null)) ? 0f : sm.height) + 102.84f) / sm.globalSimulationScale).ToString();
				obj2[12] = "m | ";
				obj2[13] = (Mathf.Floor((((Component)this).gameObject.transform.position.y + ((!((Object)(object)sm != (Object)null)) ? 0f : sm.height) + 102.84f) / 0.3048f) / sm.globalSimulationScale).ToString();
				obj2[14] = " feet | vertical distance to ground: ";
				obj2[15] = (Mathf.Floor(sm.distanceToGround / sm.globalSimulationScale * 100f) / 100f).ToString();
				obj2[16] = " m\nwind: ";
				Vector3 val2 = GWindBasic.windAt(((Component)this).gameObject.transform.position);
				obj2[17] = (Mathf.Floor(((Vector3)(ref val2)).magnitude / sm.globalSimulationScale * 3.6f * 100f) / 100f).ToString();
				obj2[18] = "km/h | ";
				Vector3 val3 = GWindBasic.windAt(((Component)this).gameObject.transform.position);
				obj2[19] = (Mathf.Floor(((Vector3)(ref val3)).magnitude / sm.globalSimulationScale * 1.9438444f * 100f) / 100f).ToString();
				obj2[20] = " knots\nsensivity: ";
				obj2[21] = sm.inputSensivity.ToString();
				obj2[22] = " | trim ailerons: ";
				obj2[23] = sm.inputAileronsTrim.ToString();
				obj2[24] = " | trim elevator: ";
				obj2[25] = sm.inputElevatorTrim.ToString();
				obj2[26] = " | trim rudder: ";
				obj2[27] = sm.inputRudderTrim.ToString();
				obj.text = string.Concat(obj2);
				if (sm.stall > 0f)
				{
					GUIText obj3 = speedmeter;
					obj3.text = obj3.text + "\nSTALL: " + Mathf.RoundToInt(sm.stall * 100f) + "%";
				}
			}
			else
			{
				speedmeter.text = "Cannot locate GAircraft attached to the same object where GSCameraAux is attached.";
			}
		}
		if ((Object)(object)autopilotmeter != (Object)null)
		{
			autopilotmeter.pixelOffset = new Vector2((float)(-Screen.width) / 2f + 10f, (float)(-Screen.height) / 2f + 10f + 10f);
		}
		ProcessGround(timeLapsus);
		ProcessClouds(timeLapsus);
		ProcessSounds(timeLapsus);
	}

	private void ProcessGround(float timeLapsus)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_010e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ground != (Object)null)
		{
			float num = searchGroundObjectGranularity;
			Vector3 position = ground.transform.position;
			if (position.x - ((Component)this).gameObject.transform.position.x > num)
			{
				position.x -= num;
			}
			if (position.x - ((Component)this).gameObject.transform.position.x < 0f - num)
			{
				position.x += num;
			}
			if (position.z - ((Component)this).gameObject.transform.position.z > num)
			{
				position.z -= num;
			}
			if (position.z - ((Component)this).gameObject.transform.position.z < 0f - num)
			{
				position.z += num;
			}
			ground.transform.position = position;
		}
	}

	public void ProcessClouds(float timeLapsus)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)clouds != (Object)null)
		{
			float num = searchCloudsObjectGranularity;
			Vector3 position = clouds.transform.position;
			Vector3 val = GWindBasic.windAt(position) * searchCloudsWindSpeedMultiplier * timeLapsus;
			position += val;
			if (position.x - ((Component)this).gameObject.transform.position.x > num)
			{
				position.x -= num;
			}
			if (position.x - ((Component)this).gameObject.transform.position.x < 0f - num)
			{
				position.x += num;
			}
			if (position.z - ((Component)this).gameObject.transform.position.z > num)
			{
				position.z -= num;
			}
			if (position.z - ((Component)this).gameObject.transform.position.z < 0f - num)
			{
				position.z += num;
			}
			clouds.transform.position = position;
		}
	}

	public static void ProcessSounds_getVolumeAndPitch(float inputmin, float inputmax, float soundmin_pivotScale, float soundmin_pitchBase, float soundmin_pitchScale, float soundmax_pivotScale, float soundmax_pitchBase, float soundmax_pitchScale, out float volume_soundmin, out float volume_soundmax, out float pitch_soundmin, out float pitch_soundmax)
	{
		volume_soundmin = inputmin / soundmin_pivotScale;
		volume_soundmax = inputmax / soundmax_pivotScale;
		pitch_soundmin = soundmin_pitchBase + volume_soundmin * 2f * soundmin_pitchScale;
		volume_soundmin = volume_soundmin * 2f * GAircraft.globalVolume;
		if (volume_soundmax > 0.5f)
		{
			pitch_soundmax = soundmax_pitchBase + volume_soundmax * 1.25f * soundmax_pitchScale;
			volume_soundmax = (volume_soundmax - 0.5f) * 2f * 2f * GAircraft.globalVolume;
		}
		else
		{
			pitch_soundmax = soundmax_pitchBase;
			volume_soundmax = 0f;
		}
		if (GAircraft.isSimulationPaused)
		{
			volume_soundmin = 0f;
			volume_soundmax = 0f;
		}
	}

	public static void ProcessSounds_getVolumeAndPitch(float input, float pivotScale, out float volume_soundmin, out float volume_soundmax, out float pitch_soundmin, out float pitch_soundmax)
	{
		float num = 1f;
		float num2 = 1f;
		float num3 = 1f;
		float num4 = 1f;
		ProcessSounds_getVolumeAndPitch(input, input, pivotScale, num, num2, pivotScale, num3, num4, out volume_soundmin, out volume_soundmax, out pitch_soundmin, out pitch_soundmax);
	}

	public static void ProcessSounds_getVolumeAndPitch(float input, out float volume_soundmin, out float volume_soundmax, out float pitch_soundmin, out float pitch_soundmax)
	{
		ProcessSounds_getVolumeAndPitch(input, 20000f, out volume_soundmin, out volume_soundmax, out pitch_soundmin, out pitch_soundmax);
	}

	private void ProcessSounds(float timeLapsus)
	{
		bool flag = false;
		bool flag2 = false;
		if (ProcessSounds_granularityTimeRemaining >= 0f)
		{
			ProcessSounds_granularityTimeRemaining -= timeLapsus;
		}
		else
		{
			ProcessSounds_granularityTimeRemaining += ProcessSounds_granularityTime;
			flag = true;
		}
		if (ProcessSounds_granularityTime2Remaining >= 0f)
		{
			ProcessSounds_granularityTime2Remaining -= timeLapsus;
		}
		else
		{
			ProcessSounds_granularityTime2Remaining += ProcessSounds_granularityTime2;
			flag2 = true;
		}
		if (!searchSounds || !((Object)(object)sm != (Object)null))
		{
			return;
		}
		float inputmin = GPivot.toTAxisValue(soundmin_pivotId, sm, "throttle");
		float inputmax = GPivot.toTAxisValue(soundmax_pivotId, sm, "throttle");
		float volume = sm.stall;
		ProcessSounds_getVolumeAndPitch(inputmin, inputmax, soundmin_pivotScale, soundmin_pitchBase, soundmin_pitchScale, soundmax_pivotScale, soundmax_pitchBase, soundmax_pitchScale, out var volume_soundmin, out var volume_soundmax, out var pitch_soundmin, out var pitch_soundmax);
		for (int i = 0; i < soundmin_count; i++)
		{
			if (sm.isCrashed)
			{
				volume_soundmin = 0f;
			}
			soundmin[i].volume = volume_soundmin;
			if (flag2)
			{
				if (soundmin[i].volume > 0f)
				{
					soundmin[i].pitch = pitch_soundmin;
				}
			}
			else if (flag && soundmin[i].volume > 0f && Mathf.Abs(soundmin[i].pitch - pitch_soundmin) >= ProcessSounds_granularityPitch)
			{
				soundmin[i].pitch = pitch_soundmin;
			}
		}
		for (int j = 0; j < soundmax_count; j++)
		{
			if (sm.isCrashed)
			{
				volume_soundmax = 0f;
			}
			soundmax[j].volume = volume_soundmax;
			if (flag2)
			{
				if (soundmax[j].volume > 0f)
				{
					soundmax[j].pitch = pitch_soundmax;
				}
			}
			else if (flag && soundmax[j].volume > 0f && Mathf.Abs(soundmax[j].pitch - pitch_soundmax) >= ProcessSounds_granularityPitch)
			{
				soundmax[j].pitch = pitch_soundmax;
			}
		}
		for (int k = 0; k < soundstall_count; k++)
		{
			if (sm.isCrashed)
			{
				volume = 0f;
			}
			soundstall[k].volume = volume;
		}
		if (!iscrashed)
		{
			if (sm.isCrashed)
			{
				iscrashed = true;
				float volume2 = 1f;
				for (int l = 0; l < soundcrash_count; l++)
				{
					soundcrash[l].volume = volume2;
					soundcrash[l].Play((ulong)Mathf.FloorToInt((float)l * 1.7f * 44100f));
				}
			}
		}
		else if (!sm.isCrashed)
		{
			iscrashed = false;
		}
	}
}
public class GSCursorAux : MonoBehaviour
{
	public enum TCursorMode
	{
		deltaPosition,
		deltaVelocity
	}

	public enum TRotationMode
	{
		none,
		pivotUp,
		worldUp
	}

	public TCursorMode cursorMode = TCursorMode.deltaPosition;

	public bool renderBack = false;

	public GameObject pivotGameobject = null;

	private Rigidbody pivotRigidbody;

	public Vector3 localDeltaPosition = Vector3.zero;

	public Vector3 deltaPosition = Vector3.zero;

	public bool deltaPositionYaw = true;

	public float velocityDistance = 1f;

	public float velocityMin = 0.25f;

	[HideInInspector]
	public float angleCalculatorDeltaElementUpDistance = 100f;

	[HideInInspector]
	public float angleCalculatorDeltaElementForwardDistance = 0f;

	public GUITexture targetGUITexture = null;

	public RotatableGUITexture targetRotatableGUITexture = null;

	public TRotationMode rotationMode = TRotationMode.pivotUp;

	private GameObject pivot = null;

	private Vector3 worldPosition = Vector3.zero;

	private Vector3 screenPoint = Vector3.zero;

	private Vector3 screenPoint2 = Vector3.zero;

	private Vector3 screenPointD = Vector3.zero;

	private Vector3 velocity = Vector3.zero;

	private Quaternion yawRotation = Quaternion.identity;

	private float angleBetween(Vector3 v1, Vector3 v2, Vector3 worldup)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val;
		if (Vector3.Dot(val = Vector3.Cross(Vector3.Normalize(v1), Vector3.Normalize(v2)), Vector3.Normalize(worldup)) > 0f)
		{
			return Mathf.Asin(((Vector3)(ref val)).magnitude) * 180f / (float)Math.PI;
		}
		return (0f - Mathf.Asin(((Vector3)(ref val)).magnitude)) * 180f / (float)Math.PI;
	}

	private float angle2D(float x, float y)
	{
		if (x > 0f)
		{
			return Mathf.Atan(y / x) * 180f / (float)Math.PI;
		}
		if (x < 0f)
		{
			return ((float)Math.PI + Mathf.Atan(y / x)) * 180f / (float)Math.PI;
		}
		if (y > 0f)
		{
			return 90f;
		}
		return -90f;
	}

	private void FixedUpdate()
	{
		//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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_0083: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: 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_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Expected O, but got Unknown
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: 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_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		pivot = pivotGameobject;
		if ((Object)(object)pivot == (Object)null)
		{
			pivot = ((Component)this).gameObject;
		}
		if (deltaPositionYaw)
		{
			Quaternion rotation = pivot.transform.rotation;
			yawRotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			worldPosition = pivot.transform.TransformPoint(localDeltaPosition) + yawRotation * deltaPosition;
		}
		else
		{
			worldPosition = pivot.transform.TransformPoint(localDeltaPosition) + deltaPosition;
		}
		TCursorMode tCursorMode = cursorMode;
		if (tCursorMode == TCursorMode.deltaPosition || tCursorMode != TCursorMode.deltaVelocity)
		{
			screenPoint = Camera.main.WorldToViewportPoint(worldPosition);
		}
		else if ((Object)(object)pivotGameobject != (Object)null)
		{
			pivotRigidbody = (Rigidbody)pivotGameobject.GetComponent("Rigidbody");
			if ((Object)(object)pivotRigidbody != (Object)null)
			{
				velocity = pivotRigidbody.velocity;
				if (((Vector3)(ref velocity)).magnitude < velocityMin)
				{
					velocity = pivotGameobject.transform.forward;
				}
			}
			else
			{
				velocity = pivotGameobject.transform.forward;
			}
			screenPoint = Camera.main.WorldToViewportPoint(worldPosition + Vector3.Normalize(velocity) * velocityDistance);
		}
		else
		{
			screenPoint = Camera.main.WorldToViewportPoint(worldPosition + Vector3.forward);
			((Component)this).gameObject.SetActive(false);
		}
		if ((Object)(object)targetGUITexture != (Object)null)
		{
			if (!renderBack && screenPoint.z < 0f)
			{
				screenPoint.x = 10f;
				screenPoint.y = 10f;
			}
			screenPoint.z = ((Component)targetGUITexture).transform.localPosition.z;
			((Component)targetGUITexture).transform.localPosition = screenPoint;
		}
		if (!((Object)(object)targetRotatableGUITexture != (Object)null))
		{
			return;
		}
		if (!renderBack && screenPoint.z < 0f)
		{
			screenPoint.x = 10f;
			screenPoint.y = 10f;
		}
		screenPoint.z = ((Component)targetRotatableGUITexture).transform.localPosition.z;
		TRotationMode tRotationMode = rotationMode;
		if (tRotationMode == TRotationMode.pivotUp || tRotationMode == TRotationMode.worldUp)
		{
			switch (rotationMode)
			{
			case TRotationMode.pivotUp:
				if ((Object)(object)pivotGameobject != (Object)null)
				{
					screenPoint2 = Camera.main.WorldToViewportPoint(worldPosition + pivotGameobject.transform.up * angleCalculatorDeltaElementUpDistance + pivotGameobject.transform.forward * angleCalculatorDeltaElementForwardDistance);
				}
				else
				{
					((Component)this).gameObject.SetActive(false);
				}
				break;
			case TRotationMode.worldUp:
				screenPoint2 = Camera.main.WorldToViewportPoint(worldPosition + Vector3.up * angleCalculatorDeltaElementUpDistance + pivotGameobject.transform.forward * angleCalculatorDeltaElementForwardDistance);
				break;
			}
			screenPointD = screenPoint2 - screenPoint;
			screenPointD.z = 0f;
			targetRotatableGUITexture.angle = 0f - angle2D(screenPointD.x, screenPointD.y) + 90f;
		}
		((Component)targetRotatableGUITexture).transform.localPosition = screenPoint;
	}
}
public class GSExplosionAux : MonoBehaviour
{
	private bool debugEnabled = false;

	private bool alive = false;

	private bool isActive = true;

	private GSGunAux controller = null;

	private GSExplosionAux nextSleeped = null;

	private float totalLifeTime = 0f;

	private float lifeTime = -1f;

	public AudioSource explosionSound = null;

	public bool ownSound = true;

	[HideInInspector]
	public float size = 1f;

	[HideInInspector]
	public Vector3 speed = Vector3.zero;

	private Vector3 scale = Vector3.one;

	private void FixedUpdate()
	{
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)