Decompiled source of Empress The Grid v1.0.2

EmpressTheGrid.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using TMPro;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Empress")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmpressTheGrid")]
[assembly: AssemblyTitle("EmpressTheGrid")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Empress.REPO.TheGrid
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.empress.repo.thegrid", "Empress The Grid", "1.0.0")]
	public sealed class EmpressTheGridPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.empress.repo.thegrid";

		public const string PluginName = "Empress The Grid";

		public const string PluginVersion = "1.0.0";

		public const string GridLevelName = "Level - Empress The Grid";

		public const string GridDisplayName = "Empress - The Grid";

		internal const byte StartEventCode = 195;

		internal const byte EliminatedEventCode = 196;

		internal const byte WinEventCode = 197;

		private static bool _photonEventsHooked;

		private Harmony _harmony;

		internal static EmpressTheGridPlugin Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		internal static GridSettings Settings { get; private set; }

		internal static Level GridLevel { get; private set; }

		private void Awake()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Settings = new GridSettings(((BaseUnityPlugin)this).Config);
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			GridLevel = GridLevelRegistry.RegisterGridLevel();
			GridAudio.InitializeMusic(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), ((BaseUnityPlugin)this).Logger);
			_harmony = new Harmony("com.empress.repo.thegrid");
			_harmony.PatchAll(typeof(EmpressTheGridPlugin).Assembly);
			GridRuntime.EnsureHost();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress The Grid v1.0.0 loaded. Level registered: Level - Empress The Grid");
		}

		private void OnDestroy()
		{
			RemovePhotonEventHook();
		}

		internal static bool IsGridLevel(Level level)
		{
			if ((Object)(object)level != (Object)null)
			{
				return ((Object)level).name == "Level - Empress The Grid";
			}
			return false;
		}

		internal static void EnsurePhotonEventHooked()
		{
			if (!_photonEventsHooked)
			{
				LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient;
				if (networkingClient != null)
				{
					networkingClient.EventReceived -= OnPhotonEvent;
					networkingClient.EventReceived += OnPhotonEvent;
					_photonEventsHooked = true;
				}
			}
		}

		internal static void RemovePhotonEventHook()
		{
			if (_photonEventsHooked)
			{
				LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient;
				if (networkingClient != null)
				{
					networkingClient.EventReceived -= OnPhotonEvent;
				}
				_photonEventsHooked = false;
			}
		}

		private static void OnPhotonEvent(EventData ev)
		{
			GridRuntime instance = GridRuntime.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			switch (ev.Code)
			{
			case 195:
			{
				object customData = ev.CustomData;
				if (customData is double)
				{
					double endTime = (double)customData;
					instance.ReceiveStart(endTime);
				}
				break;
			}
			case 196:
			{
				object customData = ev.CustomData;
				if (customData is int)
				{
					int viewId2 = (int)customData;
					instance.ReceiveEliminated(viewId2);
				}
				break;
			}
			case 197:
			{
				object customData = ev.CustomData;
				if (customData is int)
				{
					int viewId = (int)customData;
					instance.ReceiveWin(viewId);
				}
				break;
			}
			}
		}

		internal static void RaiseStart(double startTime)
		{
			RaisePhotonEvent(195, startTime, (EventCaching)4);
		}

		internal static void RaiseEliminated(int viewId)
		{
			RaisePhotonEvent(196, viewId, (EventCaching)4);
		}

		internal static void RaiseWin(int viewId)
		{
			RaisePhotonEvent(197, viewId, (EventCaching)4);
		}

		internal static void ClearGridPhotonCache()
		{
			//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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (PhotonNetwork.InRoom)
			{
				RaiseEventOptions val = new RaiseEventOptions
				{
					CachingOption = (EventCaching)6
				};
				PhotonNetwork.RaiseEvent((byte)195, (object)null, val, SendOptions.SendReliable);
				PhotonNetwork.RaiseEvent((byte)196, (object)null, val, SendOptions.SendReliable);
				PhotonNetwork.RaiseEvent((byte)197, (object)null, val, SendOptions.SendReliable);
			}
		}

		private static void RaisePhotonEvent(byte code, object payload, EventCaching caching)
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			EnsurePhotonEventHooked();
			if (PhotonNetwork.InRoom)
			{
				RaiseEventOptions val = new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)0,
					CachingOption = caching
				};
				PhotonNetwork.RaiseEvent(code, payload, val, SendOptions.SendReliable);
			}
		}
	}
	internal sealed class GridSettings
	{
		public readonly ConfigEntry<bool> ForceGridLevel;

		public readonly ConfigEntry<int> CountdownSeconds;

		public readonly ConfigEntry<float> CruiseSpeed;

		public readonly ConfigEntry<float> BoostSpeed;

		public readonly ConfigEntry<float> TurnRate;

		public readonly ConfigEntry<float> TrailLifetime;

		public readonly ConfigEntry<float> WinExitDelay;

		public GridSettings(ConfigFile config)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			ForceGridLevel = config.Bind<bool>("Debug", "ForceGridLevel", false, "Forces every real run level to load Empress - The Grid. Useful for testing.");
			CountdownSeconds = config.Bind<int>("Match", "CountdownSeconds", 10, new ConfigDescription("Countdown length before the riders are released.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 30), Array.Empty<object>()));
			CruiseSpeed = config.Bind<float>("Cycle", "CruiseSpeed", 18f, new ConfigDescription("Constant forward speed of a light cycle in meters per second.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 40f), Array.Empty<object>()));
			BoostSpeed = config.Bind<float>("Cycle", "BoostSpeed", 24f, new ConfigDescription("Forward speed while holding boost.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(8f, 55f), Array.Empty<object>()));
			TurnRate = config.Bind<float>("Cycle", "TurnRate", 130f, new ConfigDescription("Steering rate in degrees per second.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(40f, 260f), Array.Empty<object>()));
			TrailLifetime = config.Bind<float>("Cycle", "TrailLifetime", 5f, new ConfigDescription("Seconds before the tail of a light trail fades away.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>()));
			WinExitDelay = config.Bind<float>("Match", "WinExitDelay", 6f, new ConfigDescription("Seconds after a winner is decided before the level transitions away.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>()));
		}
	}
	internal static class GridAccess
	{
		private delegate void ModuleSetAllChecklistDelegate(Module module);

		private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info);

		private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone");

		private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera");

		private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor");

		private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew");

		private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious");

		private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation");

		private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew");

		private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious");

		private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp");

		private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor");

		private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew");

		private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious");

		private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance");

		private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew");

		private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious");

		private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance");

		private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew");

		private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious");

		private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady");

		private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady");

		private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned");

		private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned");

		private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious");

		private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled");

		private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet");

		private static readonly FieldInfo PlayerAvatarIsLocalField = AccessTools.Field(typeof(PlayerAvatar), "isLocal");

		private static readonly FieldInfo PlayerAvatarIsTumblingField = AccessTools.Field(typeof(PlayerAvatar), "isTumbling");

		private static readonly FieldInfo PlayerAvatarNameField = AccessTools.Field(typeof(PlayerAvatar), "playerName");

		private static readonly FieldInfo ValuableDirectorSetupCompleteField = AccessTools.Field(typeof(ValuableDirector), "setupComplete");

		private static readonly FieldInfo ValuableDirectorValuablesSpawnedField = AccessTools.Field(typeof(ValuableDirector), "valuablesSpawned");

		private static readonly FieldInfo RoundDirectorExtractionPointsField = AccessTools.Field(typeof(RoundDirector), "extractionPoints");

		private static readonly FieldInfo RoundDirectorExtractionPointsCompletedField = AccessTools.Field(typeof(RoundDirector), "extractionPointsCompleted");

		private static readonly FieldInfo RoundDirectorExtractionPointListField = AccessTools.Field(typeof(RoundDirector), "extractionPointList");

		private static readonly FieldInfo LoadingUiLevelAnimationCompletedField = AccessTools.Field(typeof(LoadingUI), "levelAnimationCompleted");

		private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone");

		private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom");

		private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX");

		private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY");

		private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom");

		private static readonly FieldInfo ItemAttributesHasIconField = AccessTools.Field(typeof(ItemAttributes), "hasIcon");

		private static readonly FieldInfo CameraAimHorizontalField = AccessTools.Field(typeof(CameraAim), "aimHorizontal");

		private static readonly FieldInfo CameraAimVerticalField = AccessTools.Field(typeof(CameraAim), "aimVertical");

		private static readonly FieldInfo CameraAimPlayerAimField = AccessTools.Field(typeof(CameraAim), "playerAim");

		private static readonly MethodInfo ModuleSetAllChecklistMethod = AccessTools.Method(typeof(Module), "SetAllChecklist", (Type[])null, (Type[])null);

		private static readonly MethodInfo LevelGeneratorGenerateDoneMethod = AccessTools.Method(typeof(LevelGenerator), "GenerateDone", new Type[1] { typeof(PhotonMessageInfo) }, (Type[])null);

		private static readonly ModuleSetAllChecklistDelegate ModuleSetAllChecklistCall = CreateDelegate<ModuleSetAllChecklistDelegate>(ModuleSetAllChecklistMethod);

		private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate<LevelGeneratorGenerateDoneDelegate>(LevelGeneratorGenerateDoneMethod);

		public static void SetEnvironmentFog(EnvironmentDirector director, Color color, float startDistance, float endDistance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			SetField(EnvironmentFogColorField, director, color);
			SetField(EnvironmentFogColorNewField, director, color);
			SetField(EnvironmentFogColorPreviousField, director, color);
			SetField(EnvironmentFogStartDistanceField, director, startDistance);
			SetField(EnvironmentFogStartDistanceNewField, director, startDistance);
			SetField(EnvironmentFogStartDistancePreviousField, director, startDistance);
			SetField(EnvironmentFogEndDistanceField, director, endDistance);
			SetField(EnvironmentFogEndDistanceNewField, director, endDistance);
			SetField(EnvironmentFogEndDistancePreviousField, director, endDistance);
		}

		public static void SetEnvironmentAmbient(EnvironmentDirector director, Color ambient, Color adaptation)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_004a: 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)
			SetField(EnvironmentAmbientColorField, director, ambient);
			SetField(EnvironmentAmbientColorNewField, director, ambient);
			SetField(EnvironmentAmbientColorPreviousField, director, ambient);
			SetField(EnvironmentAmbientColorAdaptationField, director, adaptation);
			SetField(EnvironmentAmbientColorAdaptationNewField, director, adaptation);
			SetField(EnvironmentAmbientColorAdaptationPreviousField, director, adaptation);
		}

		public static void SetEnvironmentDarkAdaptation(EnvironmentDirector director, float value)
		{
			SetField(EnvironmentDarkAdaptationLerpField, director, value);
		}

		public static Camera GetEnvironmentMainCamera(EnvironmentDirector director)
		{
			return Get<Camera>(EnvironmentMainCameraField, director);
		}

		public static void SetEnvironmentMainCamera(EnvironmentDirector director, Camera camera)
		{
			SetField(EnvironmentMainCameraField, director, camera);
		}

		public static void SetEnvironmentSetupDone(EnvironmentDirector director, bool value)
		{
			SetField(EnvironmentSetupDoneField, director, value);
		}

		public static void SetAllPlayersReady(LevelGenerator generator, bool value)
		{
			SetField(LevelGeneratorAllPlayersReadyField, generator, value);
		}

		public static bool GetAllPlayersReady(LevelGenerator generator)
		{
			return GetBool(LevelGeneratorAllPlayersReadyField, generator);
		}

		public static void SetEnemyReady(LevelGenerator generator, bool value)
		{
			SetField(LevelGeneratorEnemyReadyField, generator, value);
		}

		public static void SetModulesSpawned(LevelGenerator generator, int value)
		{
			SetField(LevelGeneratorModulesSpawnedField, generator, value);
		}

		public static void SetPlayerSpawnedCount(LevelGenerator generator, int value)
		{
			SetField(LevelGeneratorPlayerSpawnedField, generator, value);
		}

		public static int GetPlayerSpawnedCount(LevelGenerator generator)
		{
			return GetInt(LevelGeneratorPlayerSpawnedField, generator);
		}

		public static void SetLevelPrevious(RunManager manager, Level level)
		{
			SetField(RunManagerLevelPreviousField, manager, level);
		}

		public static bool GetIsDisabled(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarIsDisabledField, avatar);
		}

		public static bool GetDeadSet(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarDeadSetField, avatar);
		}

		public static bool GetIsLocal(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarIsLocalField, avatar);
		}

		public static bool GetIsTumbling(PlayerAvatar avatar)
		{
			return GetBool(PlayerAvatarIsTumblingField, avatar);
		}

		public static string GetPlayerName(PlayerAvatar avatar)
		{
			if ((Object)(object)avatar == (Object)null)
			{
				return "RIDER";
			}
			string text = Get<string>(PlayerAvatarNameField, avatar);
			if (!string.IsNullOrWhiteSpace(text))
			{
				return text;
			}
			string text2 = (((Object)(object)((Component)avatar).gameObject != (Object)null) ? ((Object)((Component)avatar).gameObject).name : string.Empty).Replace("Player Avatar ", string.Empty).Replace("PlayerAvatar", string.Empty).Trim();
			if (!string.IsNullOrWhiteSpace(text2))
			{
				return text2;
			}
			return "RIDER";
		}

		public static void SetValuableSetupComplete(ValuableDirector director, bool value)
		{
			SetField(ValuableDirectorSetupCompleteField, director, value);
		}

		public static void SetValuableValuablesSpawned(ValuableDirector director, bool value)
		{
			SetField(ValuableDirectorValuablesSpawnedField, director, value);
		}

		public static void ResetRoundExtraction(RoundDirector director)
		{
			SetField(RoundDirectorExtractionPointsField, director, 0);
			SetField(RoundDirectorExtractionPointsCompletedField, director, 0);
			Get<List<GameObject>>(RoundDirectorExtractionPointListField, director)?.Clear();
		}

		public static bool GetLevelAnimationCompleted(LoadingUI ui)
		{
			return GetBool(LoadingUiLevelAnimationCompletedField, ui);
		}

		public static void ConfigureStartRoomModule(Module module, int gridX, int gridY)
		{
			ModuleSetAllChecklistCall?.Invoke(module);
			SetField(ModuleSetupDoneField, module, true);
			SetField(ModuleStartRoomField, module, true);
			SetField(ModuleGridXField, module, gridX);
			SetField(ModuleGridYField, module, gridY);
		}

		public static void MarkLevelPointInStartRoom(LevelPoint point, bool value)
		{
			SetField(LevelPointInStartRoomField, point, value);
		}

		public static bool GetItemHasIcon(ItemAttributes attributes)
		{
			return GetBool(ItemAttributesHasIconField, attributes);
		}

		public static void SetCameraHeading(CameraAim cameraAim, float horizontal, float vertical)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)cameraAim == (Object)null))
			{
				SetField(CameraAimHorizontalField, cameraAim, horizontal);
				SetField(CameraAimVerticalField, cameraAim, vertical);
				SetField(CameraAimPlayerAimField, cameraAim, Quaternion.Euler(vertical, horizontal, 0f));
			}
		}

		public static float GetCameraVertical(CameraAim cameraAim)
		{
			return GetFloat(CameraAimVerticalField, cameraAim);
		}

		public static void GenerateDone(LevelGenerator generator)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo));
		}

		private static T Get<T>(FieldInfo field, object instance) where T : class
		{
			if (field == null || instance == null)
			{
				return null;
			}
			return field.GetValue(instance) as T;
		}

		private static bool GetBool(FieldInfo field, object instance)
		{
			if (field == null || instance == null)
			{
				return false;
			}
			object value = field.GetValue(instance);
			bool flag = default(bool);
			int num;
			if (value is bool)
			{
				flag = (bool)value;
				num = 1;
			}
			else
			{
				num = 0;
			}
			return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
		}

		private static int GetInt(FieldInfo field, object instance)
		{
			if (field == null || instance == null)
			{
				return 0;
			}
			object value = field.GetValue(instance);
			if (value is int)
			{
				return (int)value;
			}
			return 0;
		}

		private static float GetFloat(FieldInfo field, object instance)
		{
			if (field == null || instance == null)
			{
				return 0f;
			}
			object value = field.GetValue(instance);
			if (value is float)
			{
				return (float)value;
			}
			return 0f;
		}

		private static void SetField(FieldInfo field, object instance, object value)
		{
			if (!(field == null) && instance != null)
			{
				field.SetValue(instance, value);
			}
		}

		private static TDelegate CreateDelegate<TDelegate>(MethodInfo method) where TDelegate : Delegate
		{
			if (method == null)
			{
				return null;
			}
			return AccessTools.MethodDelegate<TDelegate>(method, (object)null, true);
		}
	}
	internal static class GridAudio
	{
		private const string MusicBundleName = "empresstronaudio";

		private const int SampleRate = 44100;

		private static AudioClip _engineClip;

		private static AudioClip _explosionClip;

		private static AudioClip _musicClip;

		private static AssetBundle _musicBundle;

		private static bool _musicInitialized;

		public static AudioClip EngineClip
		{
			get
			{
				if ((Object)(object)_engineClip == (Object)null)
				{
					_engineClip = BuildEngineClip();
				}
				return _engineClip;
			}
		}

		public static AudioClip ExplosionClip
		{
			get
			{
				if ((Object)(object)_explosionClip == (Object)null)
				{
					_explosionClip = BuildExplosionClip();
				}
				return _explosionClip;
			}
		}

		public static AudioClip MusicClip => _musicClip;

		public static void InitializeMusic(string pluginDirectory, ManualLogSource log)
		{
			if (_musicInitialized)
			{
				return;
			}
			_musicInitialized = true;
			string text = ResolveMusicPath(pluginDirectory);
			if (text == null || !File.Exists(text))
			{
				log.LogWarning((object)"Empress The Grid music bundle (empresstronaudio) not found beside DLL. The grid will run without music.");
				return;
			}
			_musicBundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)_musicBundle == (Object)null)
			{
				log.LogWarning((object)("Empress The Grid could not load music bundle at " + text));
				return;
			}
			string[] allAssetNames = _musicBundle.GetAllAssetNames();
			foreach (string text2 in allAssetNames)
			{
				AudioClip val = _musicBundle.LoadAsset<AudioClip>(text2);
				if ((Object)(object)val != (Object)null)
				{
					_musicClip = val;
					break;
				}
			}
			if ((Object)(object)_musicClip != (Object)null)
			{
				log.LogInfo((object)("Empress The Grid loaded music clip \"" + ((Object)_musicClip).name + "\"."));
			}
		}

		public static void PlayExplosion(Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			AudioSource.PlayClipAtPoint(ExplosionClip, position, 0.3f);
		}

		private static string ResolveMusicPath(string pluginDirectory)
		{
			string[] array = new string[3]
			{
				Path.Combine(pluginDirectory, "empresstronaudio"),
				Path.Combine(pluginDirectory ?? string.Empty, "Audio", "empresstronaudio"),
				Path.Combine(Path.GetDirectoryName(pluginDirectory) ?? pluginDirectory ?? string.Empty, "empresstronaudio")
			};
			for (int i = 0; i < array.Length; i++)
			{
				if (File.Exists(array[i]))
				{
					return array[i];
				}
			}
			return array[0];
		}

		private static AudioClip BuildEngineClip()
		{
			int num = 44100;
			float[] array = new float[num];
			float num2 = 70f;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f * num2;
				float num4 = (num3 - Mathf.Floor(num3)) * 2f - 1f;
				float num5 = Mathf.Sin(num3 * MathF.PI * 2f * 2f) * 0.3f;
				float num6 = Mathf.Sin(num3 * MathF.PI * 2f * 0.5f) * 0.2f;
				array[i] = Mathf.Clamp(num4 * 0.5f + num5 + num6, -1f, 1f) * 0.6f;
			}
			AudioClip obj = AudioClip.Create("EmpressTronEngine", num, 1, 44100, false);
			obj.SetData(array, 0);
			return obj;
		}

		private static AudioClip BuildExplosionClip()
		{
			int num = 30870;
			float[] array = new float[num];
			Random random = new Random(1337);
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / (float)num;
				float num3 = Mathf.Pow(1f - num2, 2.2f);
				float num4 = (float)(random.NextDouble() * 2.0 - 1.0);
				float num5 = Mathf.Sin((float)i / 44100f * MathF.PI * 2f * 55f);
				array[i] = Mathf.Clamp((num4 * 0.7f + num5 * 0.3f) * num3, -1f, 1f);
			}
			AudioClip obj = AudioClip.Create("EmpressTronExplosion", num, 1, 44100, false);
			obj.SetData(array, 0);
			return obj;
		}
	}
	internal sealed class GridCycle
	{
		private const float TrailGap = 4.5f;

		private GridTrail _trail;

		private Light _glow;

		private Transform _bike;

		private AudioSource _engine;

		private readonly List<Renderer> _hiddenAvatarRenderers = new List<Renderer>();

		private Vector3 _lastSamplePosition;

		private bool _hasLastSample;

		private Quaternion _facing = Quaternion.identity;

		public PlayerAvatar Avatar { get; private set; }

		public int ViewId { get; private set; }

		public int ColorIndex { get; private set; }

		public bool IsLocal { get; private set; }

		public bool Eliminated { get; private set; }

		public Color Color { get; private set; }

		public Vector3 Position
		{
			get
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)Avatar != (Object)null))
				{
					return Vector3.zero;
				}
				return ((Component)Avatar).transform.position;
			}
		}

		public bool IsValid => (Object)(object)Avatar != (Object)null;

		public static GridCycle Create(PlayerAvatar avatar, int viewId, int colorIndex, bool isLocal, Transform trailParent, float trailLifetime)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			GridCycle obj = new GridCycle
			{
				Avatar = avatar,
				ViewId = viewId,
				ColorIndex = colorIndex,
				IsLocal = isLocal,
				Color = GridMaterials.RiderColor(colorIndex)
			};
			Material bodyMaterial = GridMaterials.CreateTrailBodyMaterial(obj.Color);
			Material capMaterial = GridMaterials.CreateTrailCapMaterial(obj.Color);
			obj._trail = GridTrail.Create(trailParent, bodyMaterial, capMaterial, trailLifetime);
			obj.BuildBike(trailParent);
			obj.HideAvatar();
			return obj;
		}

		public void SetRecording(bool recording)
		{
			if ((Object)(object)_trail != (Object)null)
			{
				_trail.SetRecording(recording && !Eliminated);
			}
		}

		public void ClearTrail()
		{
			if ((Object)(object)_trail != (Object)null)
			{
				_trail.ClearTrail();
			}
		}

		public void Sample()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Avatar == (Object)null))
			{
				Vector3 position = ((Component)Avatar).transform.position;
				Vector3 val = position - _lastSamplePosition;
				val.y = 0f;
				float magnitude = ((Vector3)(ref val)).magnitude;
				Vector3 val2 = position + Vector3.up * 0.1f;
				if (_hasLastSample && magnitude > 0.08f)
				{
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					val2 -= normalized * 4.5f;
					_facing = Quaternion.LookRotation(normalized, Vector3.up);
				}
				if ((Object)(object)_trail != (Object)null)
				{
					_trail.Sample(val2);
				}
				if ((Object)(object)_bike != (Object)null)
				{
					_bike.position = position + Vector3.up * 0.05f;
					_bike.rotation = _facing;
				}
				if ((Object)(object)_engine != (Object)null)
				{
					float num = magnitude / Mathf.Max(0.0001f, Time.deltaTime);
					_engine.pitch = Mathf.Lerp(_engine.pitch, Mathf.Clamp(0.6f + num * 0.05f, 0.6f, 2.2f), Time.deltaTime * 6f);
				}
				_lastSamplePosition = position;
				_hasLastSample = true;
			}
		}

		public bool TrailIntersects(Vector3 position, float radius, int skipNewestCount)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_trail != (Object)null)
			{
				return _trail.Intersects(position, radius, skipNewestCount);
			}
			return false;
		}

		public void Eliminate()
		{
			if (!Eliminated)
			{
				Eliminated = true;
				if ((Object)(object)_trail != (Object)null)
				{
					_trail.SetRecording(recording: false);
				}
				if ((Object)(object)_glow != (Object)null)
				{
					_glow.intensity = 0.4f;
				}
				if ((Object)(object)_engine != (Object)null)
				{
					_engine.Stop();
				}
				if ((Object)(object)_bike != (Object)null)
				{
					((Component)_bike).gameObject.SetActive(false);
				}
			}
		}

		public void Dispose()
		{
			ShowAvatar();
			if ((Object)(object)_trail != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_trail).gameObject);
			}
			if ((Object)(object)_bike != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_bike).gameObject);
			}
		}

		private void BuildBike(Transform parent)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Light Bike " + ViewId);
			val.transform.SetParent(parent, false);
			_bike = val.transform;
			Material material = GridMaterials.CreateBikeMaterial(Color);
			Material material2 = GridMaterials.CreateBikeMaterial(Color * 0.5f);
			AddPart(val.transform, "Body", (PrimitiveType)3, new Vector3(0f, 0.45f, 0f), new Vector3(0.42f, 0.38f, 2f), material);
			AddPart(val.transform, "Canopy", (PrimitiveType)3, new Vector3(0f, 0.72f, -0.25f), new Vector3(0.34f, 0.3f, 0.9f), material);
			AddPart(val.transform, "Front Wheel", (PrimitiveType)2, new Vector3(0f, 0.42f, 0.95f), new Vector3(0.78f, 0.08f, 0.78f), material2).transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			AddPart(val.transform, "Rear Wheel", (PrimitiveType)2, new Vector3(0f, 0.42f, -0.95f), new Vector3(0.86f, 0.08f, 0.86f), material2).transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			AddPart(val.transform, "Light Strip", (PrimitiveType)3, new Vector3(0f, 0.62f, 0f), new Vector3(0.46f, 0.06f, 1.6f), material);
			GameObject val2 = new GameObject("Bike Glow");
			val2.transform.SetParent(val.transform, false);
			val2.transform.localPosition = new Vector3(0f, 0.6f, 0f);
			_glow = val2.AddComponent<Light>();
			_glow.type = (LightType)2;
			_glow.color = Color;
			_glow.intensity = 2.4f;
			_glow.range = 8f;
			_engine = val.AddComponent<AudioSource>();
			_engine.clip = GridAudio.EngineClip;
			_engine.loop = true;
			_engine.volume = 0.1f;
			_engine.spatialBlend = (IsLocal ? 0.2f : 1f);
			_engine.minDistance = 4f;
			_engine.maxDistance = 60f;
			_engine.rolloffMode = (AudioRolloffMode)1;
			_engine.pitch = 0.6f;
			_engine.Play();
		}

		private static GameObject AddPart(Transform parent, string name, PrimitiveType type, Vector3 localPosition, Vector3 localScale, Material material)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(type);
			((Object)obj).name = name;
			obj.transform.SetParent(parent, false);
			obj.transform.localPosition = localPosition;
			obj.transform.localScale = localScale;
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = obj.GetComponent<Renderer>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)material != (Object)null)
			{
				component2.sharedMaterial = material;
			}
			return obj;
		}

		private void HideAvatar()
		{
			if ((Object)(object)Avatar == (Object)null)
			{
				return;
			}
			Renderer[] componentsInChildren = ((Component)Avatar).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && val.enabled)
				{
					val.enabled = false;
					_hiddenAvatarRenderers.Add(val);
				}
			}
		}

		private void ShowAvatar()
		{
			for (int i = 0; i < _hiddenAvatarRenderers.Count; i++)
			{
				if ((Object)(object)_hiddenAvatarRenderers[i] != (Object)null)
				{
					_hiddenAvatarRenderers[i].enabled = true;
				}
			}
			_hiddenAvatarRenderers.Clear();
		}
	}
	internal sealed class GridHud : MonoBehaviour
	{
		private bool _visible;

		private bool _repoHudHidden;

		private string _countdown = string.Empty;

		private string _banner = string.Empty;

		private Color _bannerColor = Color.white;

		private int _speedMph;

		private GUIStyle _countdownStyle;

		private GUIStyle _bannerStyle;

		private GUIStyle _speedStyle;

		private GUIStyle _unitStyle;

		private bool _stylesReady;

		public static GridHud Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0024: Expected O, but got Unknown
			GameObject val = new GameObject("Empress Grid HUD");
			val.transform.parent = null;
			((Object)val).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)val);
			return val.AddComponent<GridHud>();
		}

		public void SetVisible(bool visible)
		{
			_visible = visible;
		}

		public void SetSpeed(float metersPerSecond)
		{
			_speedMph = Mathf.RoundToInt(metersPerSecond * 2.23694f);
		}

		public void SetCountdown(string text)
		{
			_countdown = text ?? string.Empty;
		}

		public void SetBanner(string text, Color color)
		{
			//IL_0011: 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)
			_banner = text ?? string.Empty;
			_bannerColor = color;
		}

		public void HideRepoHud()
		{
			if (!_repoHudHidden && (Object)(object)HUD.instance != (Object)null)
			{
				HUD.instance.Hide();
				_repoHudHidden = true;
			}
		}

		public void ShowRepoHud()
		{
			if (_repoHudHidden)
			{
				if ((Object)(object)HUD.instance != (Object)null)
				{
					HUD.instance.Show();
				}
				_repoHudHidden = false;
			}
		}

		private void OnGUI()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (_visible)
			{
				EnsureStyles();
				float num = Screen.width;
				float num2 = Screen.height;
				if (!string.IsNullOrEmpty(_countdown))
				{
					DrawShadowed(new Rect(0f, num2 * 0.22f, num, num2 * 0.4f), _countdown, _countdownStyle, new Color(0.5f, 0.95f, 1f));
				}
				if (!string.IsNullOrEmpty(_banner))
				{
					DrawShadowed(new Rect(0f, num2 * 0.62f, num, num2 * 0.16f), _banner, _bannerStyle, _bannerColor);
				}
				string text = _speedMph.ToString();
				DrawShadowed(new Rect(num - 360f, num2 - 150f, 300f, 110f), text, _speedStyle, new Color(0.4f, 0.95f, 1f));
				DrawShadowed(new Rect(num - 360f, num2 - 56f, 300f, 36f), "MPH", _unitStyle, new Color(0.6f, 0.85f, 1f));
			}
		}

		private static void DrawShadowed(Rect rect, string text, GUIStyle style, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = new Color(0f, 0.04f, 0.08f, 0.85f);
			GUI.Label(new Rect(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style);
			GUI.color = color;
			GUI.Label(rect, text, style);
			GUI.color = color2;
		}

		private void EnsureStyles()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0037: Expected O, but got Unknown
			//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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_006d: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//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_00a5: 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_00b8: Expected O, but got Unknown
			if (!_stylesReady)
			{
				_countdownStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 180,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_bannerStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 60,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_speedStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 80,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)8
				};
				_unitStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 28,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)8
				};
				_stylesReady = true;
			}
		}
	}
	internal static class GridLevelRegistry
	{
		private static readonly FieldRef<LevelContent, Level> LevelContentLevelRef = AccessTools.FieldRefAccess<LevelContent, Level>("_level");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentStartRoomsRef = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_startRooms");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal3");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage3");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd3");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction1");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction2");

		private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction3");

		private static readonly FieldRef<LevelContent, GameObject> LevelContentConnectObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_connectObject");

		private static readonly FieldRef<LevelContent, GameObject> LevelContentBlockObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_blockObject");

		public static Level RegisterGridLevel()
		{
			//IL_00e9: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			Level val = ScriptableObject.CreateInstance<Level>();
			((Object)val).name = "Level - Empress The Grid";
			val.NarrativeName = "Empress - The Grid";
			LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>();
			((Object)val2).name = "Valuables - Empress The Grid";
			val2.tiny = new List<PrefabRef>();
			val2.small = new List<PrefabRef>();
			val2.medium = new List<PrefabRef>();
			val2.big = new List<PrefabRef>();
			val2.wide = new List<PrefabRef>();
			val2.tall = new List<PrefabRef>();
			val2.veryTall = new List<PrefabRef>();
			SetLevelField(val, "ModuleAmount", 0);
			SetLevelField(val, "PassageMaxAmount", 0);
			SetLevelField(val, "HasEnemies", false);
			SetLevelField(val, "ValuablePresets", new List<LevelValuables> { val2 });
			SetLevelField(val, "AmbiencePresets", new List<LevelAmbience>());
			SetLevelField(val, "FogColor", (object)new Color(0.01f, 0.02f, 0.05f));
			SetLevelField(val, "FogStartDistance", 20f);
			SetLevelField(val, "FogEndDistance", 220f);
			SetLevelField(val, "AmbientColor", (object)new Color(0.04f, 0.12f, 0.22f));
			SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.01f, 0.04f, 0.08f));
			SetLevelField(val, "ColorTemperature", -12f);
			SetLevelField(val, "ColorFilter", (object)new Color(0.7f, 0.92f, 1f, 1f));
			SetLevelField(val, "BloomIntensity", 7.5f);
			SetLevelField(val, "BloomThreshold", 0.7f);
			SetLevelField(val, "VignetteColor", (object)new Color(0.01f, 0.02f, 0.05f, 1f));
			SetLevelField(val, "VignetteIntensity", 0.36f);
			SetLevelField(val, "VignetteSmoothness", 0.8f);
			SetLevelField(val, "DiscordIcon", "level");
			EnsureLevelFieldInstance(val, "LoadingGraphic01");
			EnsureLevelFieldInstance(val, "LoadingGraphic02");
			EnsureLevelFieldInstance(val, "LoadingGraphic03");
			EnsureLevelFieldInstance(val, "ConnectObject");
			EnsureLevelFieldInstance(val, "BlockObject");
			LevelContent val3 = ScriptableObject.CreateInstance<LevelContent>();
			((Object)val3).name = "Empress The Grid Content";
			LevelContentLevelRef.Invoke(val3) = val;
			LevelContentStartRoomsRef.Invoke(val3) = new List<GameObject>();
			LevelContentModulesNormal1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesNormal2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesNormal3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesPassage1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesPassage2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesPassage3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesExtraction1Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesExtraction2Ref.Invoke(val3) = new List<GameObject>();
			LevelContentModulesExtraction3Ref.Invoke(val3) = new List<GameObject>();
			LevelContentConnectObjectRef.Invoke(val3) = null;
			LevelContentBlockObjectRef.Invoke(val3) = null;
			Levels.RegisterLevel(val3);
			return val;
		}

		private static void SetLevelField(Level level, string fieldName, object value)
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName);
			if (!(fieldInfo == null) && value != null && fieldInfo.FieldType.IsInstanceOfType(value))
			{
				fieldInfo.SetValue(level, value);
			}
		}

		private static void EnsureLevelFieldInstance(Level level, string fieldName)
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName);
			if (!(fieldInfo == null) && fieldInfo.FieldType.IsClass && !(fieldInfo.FieldType == typeof(string)) && fieldInfo.GetValue(level) == null)
			{
				object uninitializedObject = FormatterServices.GetUninitializedObject(fieldInfo.FieldType);
				fieldInfo.SetValue(level, uninitializedObject);
			}
		}
	}
	internal sealed class GridLoadingScreen : MonoBehaviour
	{
		private const int VerticalLinesPerSide = 9;

		private const int HorizontalLines = 13;

		private const float HorizonFrac = 0.58f;

		private const float DepthScale = 0.55f;

		private const float ScrollSpeed = 0.32f;

		private const float IntroDuration = 1.4f;

		private const float BottomSpread = 1.35f;

		private static readonly Color LineColor = new Color(0.16f, 0.68f, 1f, 1f);

		private static readonly Color HorizonColor = new Color(0.6f, 0.95f, 1f, 1f);

		private static GridLoadingScreen _instance;

		private static Sprite _sprite;

		private RectTransform _root;

		private readonly List<Image> _verticals = new List<Image>();

		private readonly List<Image> _horizontals = new List<Image>();

		private Image _horizon;

		private Image _horizonGlow;

		private float _introTime;

		private float _phase;

		public static void Apply(LoadingUI ui, bool gridLevel)
		{
			if (!gridLevel)
			{
				if ((Object)(object)_instance != (Object)null)
				{
					((Component)_instance).gameObject.SetActive(false);
				}
			}
			else if (!((Object)(object)ui == (Object)null))
			{
				if ((Object)(object)_instance == (Object)null)
				{
					_instance = Build();
				}
				if (!((Object)(object)_instance == (Object)null))
				{
					_instance.Reparent(ui);
					((Component)_instance).gameObject.SetActive(true);
					_instance._introTime = 0f;
					_instance._phase = 0f;
				}
			}
		}

		private static GridLoadingScreen Build()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Empress Grid Loading")
			{
				hideFlags = (HideFlags)61
			};
			RectTransform val2 = val.AddComponent<RectTransform>();
			GridLoadingScreen gridLoadingScreen = val.AddComponent<GridLoadingScreen>();
			gridLoadingScreen._root = val2;
			gridLoadingScreen._horizonGlow = CreateLine((Transform)(object)val2, "Horizon Glow");
			for (int i = 0; i < 13; i++)
			{
				gridLoadingScreen._horizontals.Add(CreateLine((Transform)(object)val2, "Grid Horizontal"));
			}
			for (int j = 0; j < 19; j++)
			{
				gridLoadingScreen._verticals.Add(CreateLine((Transform)(object)val2, "Grid Vertical"));
			}
			gridLoadingScreen._horizon = CreateLine((Transform)(object)val2, "Horizon");
			return gridLoadingScreen;
		}

		private void Reparent(LoadingUI ui)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)ui).transform;
			((Transform)_root).SetParent(transform, false);
			Transform val = TopLevelContainer(transform, ((Object)(object)ui.levelNameText != (Object)null) ? ((TMP_Text)ui.levelNameText).transform : null);
			if ((Object)(object)val != (Object)null)
			{
				((Transform)_root).SetSiblingIndex(val.GetSiblingIndex());
			}
			else
			{
				((Transform)_root).SetAsFirstSibling();
			}
			((Transform)_root).localScale = Vector3.one;
			((Transform)_root).localRotation = Quaternion.identity;
			_root.anchorMin = Vector2.zero;
			_root.anchorMax = Vector2.one;
			_root.pivot = new Vector2(0.5f, 0.5f);
			_root.offsetMin = Vector2.zero;
			_root.offsetMax = Vector2.zero;
		}

		private static Transform TopLevelContainer(Transform root, Transform descendant)
		{
			if ((Object)(object)descendant == (Object)null)
			{
				return null;
			}
			Transform val = descendant;
			while ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)root)
			{
				val = val.parent;
			}
			if (!((Object)(object)val.parent == (Object)(object)root))
			{
				return null;
			}
			return val;
		}

		private void Update()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_root == (Object)null))
			{
				Rect rect = _root.rect;
				float width = ((Rect)(ref rect)).width;
				float height = ((Rect)(ref rect)).height;
				if (!(width < 1f) && !(height < 1f))
				{
					_introTime += Time.unscaledDeltaTime;
					float num = Mathf.Clamp01(_introTime / 1.4f);
					float num2 = 1f - Mathf.Pow(1f - num, 3f);
					_phase = Mathf.Repeat(_phase + Time.unscaledDeltaTime * 0.32f, 1f);
					float scale = Mathf.Max(0.5f, height / 1080f);
					float num3 = (0f - height) * 0.5f;
					float num4 = Mathf.Lerp(num3, (0f - height) * 0.5f + 0.58f * height, num2);
					float floorHeight = num4 - num3;
					float halfBottom = width * 0.5f * 1.35f;
					float spread = 0.25f + 0.75f * num2;
					UpdateHorizon(num4, width, scale, num2);
					UpdateVerticals(num4, num3, halfBottom, spread, scale, num2);
					UpdateHorizontals(num4, num3, floorHeight, halfBottom, scale, num2);
				}
			}
		}

		private void UpdateHorizon(float yHorizon, float width, float scale, float ease)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_006e: 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)
			float num = 0.22f * ease;
			Place(_horizonGlow, new Vector2(0f, yHorizon), new Vector2(width, 26f * scale), 0f, new Color(HorizonColor.r, HorizonColor.g, HorizonColor.b, num));
			Place(_horizon, new Vector2(0f, yHorizon), new Vector2(width, 4f * scale), 0f, new Color(HorizonColor.r, HorizonColor.g, HorizonColor.b, ease));
		}

		private void UpdateVerticals(float yHorizon, float yBottom, float halfBottom, float spread, float scale, float ease)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_005e: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, yHorizon);
			Vector2 val2 = default(Vector2);
			Color color = default(Color);
			for (int i = 0; i < _verticals.Count; i++)
			{
				float num = (float)(i - 9) / 9f;
				float num2 = num * halfBottom * spread;
				((Vector2)(ref val2))..ctor(num2, yBottom);
				Vector2 val3 = val2 - val;
				float magnitude = ((Vector2)(ref val3)).magnitude;
				float angle = Mathf.Atan2(val3.y, val3.x) * 57.29578f;
				Vector2 position = (val + val2) * 0.5f;
				float num3 = 1f - 0.4f * Mathf.Abs(num);
				((Color)(ref color))..ctor(LineColor.r, LineColor.g, LineColor.b, ease * num3);
				Place(_verticals[i], position, new Vector2(magnitude, 2.4f * scale), angle, color);
			}
		}

		private void UpdateHorizontals(float yHorizon, float yBottom, float floorHeight, float halfBottom, float scale, float ease)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			for (int i = 0; i < _horizontals.Count; i++)
			{
				float num = (float)(i + 1) - _phase;
				float num2 = 1f / (1f + num * 0.55f);
				float num3 = Mathf.Lerp(yHorizon, yBottom, num2);
				float num4 = 2f * halfBottom * num2;
				float num5 = ease * Mathf.Clamp01(0.2f + 0.8f * num2);
				((Color)(ref color))..ctor(LineColor.r, LineColor.g, LineColor.b, num5);
				Place(_horizontals[i], new Vector2(0f, num3), new Vector2(num4, (1.4f + 1.6f * num2) * scale), 0f, color);
			}
		}

		private static void Place(Image image, Vector2 position, Vector2 size, float angle, Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			if (!((Object)(object)image == (Object)null))
			{
				RectTransform rectTransform = ((Graphic)image).rectTransform;
				rectTransform.anchoredPosition = position;
				rectTransform.sizeDelta = size;
				((Transform)rectTransform).localRotation = Quaternion.Euler(0f, 0f, angle);
				((Graphic)image).color = color;
			}
		}

		private static Image CreateLine(Transform parent, string name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			RectTransform obj = val.AddComponent<RectTransform>();
			((Transform)obj).SetParent(parent, false);
			obj.anchorMin = new Vector2(0.5f, 0.5f);
			obj.anchorMax = new Vector2(0.5f, 0.5f);
			obj.pivot = new Vector2(0.5f, 0.5f);
			Image obj2 = val.AddComponent<Image>();
			obj2.sprite = WhiteSprite();
			obj2.type = (Type)0;
			((Graphic)obj2).raycastTarget = false;
			((Graphic)obj2).color = LineColor;
			return obj2;
		}

		private static Sprite WhiteSprite()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			if ((Object)(object)_sprite != (Object)null)
			{
				return _sprite;
			}
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			val.SetPixel(0, 0, Color.white);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			_sprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f);
			return _sprite;
		}
	}
	internal sealed class GridMap
	{
		public readonly List<Vector3> BoostPads = new List<Vector3>();

		public readonly List<Vector3> JumpPads = new List<Vector3>();

		public readonly List<Vector3> SpawnPositions = new List<Vector3>();

		public float BoostRadius = 3.2f;

		public float JumpRadius = 3.2f;

		public float ArenaHalfExtent = 70f;

		public float KillFloorY = -25f;

		public float TopDeckY = 12f;
	}
	internal static class GridMapBuilder
	{
		private const float BottomHalf = 70f;

		private const float WallHeight = 9f;

		private const float WallThickness = 1.2f;

		private const float DeckThickness = 1.4f;

		private const float RampThickness = 1.6f;

		private const float TopDeckY = 12f;

		private const float TopHalf = 40f;

		private const float HoleHalf = 13f;

		private const float LineSurfaceOffset = 0.06f;

		public static GridMap Build(Transform parent)
		{
			GridMaterials.EnsureCreated();
			GridMap gridMap = new GridMap
			{
				TopDeckY = 12f,
				ArenaHalfExtent = 70f
			};
			BuildBottomDeck(parent);
			BuildPerimeterWalls(parent);
			BuildWallTrim(parent);
			BuildGridLines(parent, 0.06f, 70f, 10f);
			BuildMajorGridLines(parent, 0.08f, 70f, 20f);
			BuildDeckTrim(parent, 0.08f, 70f);
			BuildCenterRings(parent, 0.089999996f);
			BuildTopDeck(parent);
			BuildHoleFrame(parent);
			BuildRamps(parent, gridMap);
			BuildBoostPads(parent, gridMap);
			BuildJumpPads(parent, gridMap);
			BuildCornerPillars(parent);
			BuildLights(parent);
			BuildSpawnPositions(gridMap);
			return gridMap;
		}

		private static void BuildBottomDeck(Transform parent)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			CreateBox(parent, "Bottom Deck", new Vector3(0f, -0.7f, 0f), new Vector3(140f, 1.4f, 140f), GridMaterials.DeckMaterial, solid: true);
		}

		private static void BuildPerimeterWalls(Transform parent)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0087: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			float num = 142.4f;
			CreateBox(parent, "Wall North", new Vector3(0f, 4.5f, 70.6f), new Vector3(num, 9f, 1.2f), GridMaterials.WallMaterial, solid: true);
			CreateBox(parent, "Wall South", new Vector3(0f, 4.5f, -70.6f), new Vector3(num, 9f, 1.2f), GridMaterials.WallMaterial, solid: true);
			CreateBox(parent, "Wall East", new Vector3(70.6f, 4.5f, 0f), new Vector3(1.2f, 9f, num), GridMaterials.WallMaterial, solid: true);
			CreateBox(parent, "Wall West", new Vector3(-70.6f, 4.5f, 0f), new Vector3(1.2f, 9f, num), GridMaterials.WallMaterial, solid: true);
		}

		private static void BuildTopDeck(Transform parent)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			float num = 13.5f;
			float num2 = 13f + num;
			CreateBox(parent, "Top Deck North", new Vector3(0f, 12f, num2), new Vector3(80f, 1.4f, num * 2f), GridMaterials.DeckMaterial, solid: true);
			CreateBox(parent, "Top Deck South", new Vector3(0f, 12f, 0f - num2), new Vector3(80f, 1.4f, num * 2f), GridMaterials.DeckMaterial, solid: true);
			CreateBox(parent, "Top Deck East", new Vector3(num2, 12f, 0f), new Vector3(num * 2f, 1.4f, 26f), GridMaterials.DeckMaterial, solid: true);
			CreateBox(parent, "Top Deck West", new Vector3(0f - num2, 12f, 0f), new Vector3(num * 2f, 1.4f, 26f), GridMaterials.DeckMaterial, solid: true);
			BuildGridLines(parent, 12.76f, 40f, 10f);
			BuildMajorGridLines(parent, 12.780001f, 40f, 20f);
		}

		private static void BuildRamps(Transform parent, GridMap map)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			float num = 12.7f;
			float num2 = 64f;
			CreateRamp(parent, "Ramp South", new Vector3(0f, 0f, 0f - num2), new Vector3(0f, num, -40f), 16f);
			CreateRamp(parent, "Ramp North", new Vector3(0f, 0f, num2), new Vector3(0f, num, 40f), 16f);
			CreateRamp(parent, "Ramp East", new Vector3(num2, 0f, 0f), new Vector3(40f, num, 0f), 16f);
			CreateRamp(parent, "Ramp West", new Vector3(0f - num2, 0f, 0f), new Vector3(-40f, num, 0f), 16f);
		}

		private static void CreateRamp(Transform parent, string name, Vector3 bottomSurface, Vector3 topSurface, float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004f: 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_005d: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = topSurface - bottomSurface;
			float magnitude = ((Vector3)(ref val)).magnitude;
			Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up);
			Vector3 val3 = val2 * Vector3.up;
			Vector3 val4 = (bottomSurface + topSurface) * 0.5f - val3 * 0.8f;
			CreateBox(parent, name, val4, new Vector3(width, 1.6f, magnitude), GridMaterials.RampMaterial, solid: true).transform.localRotation = val2;
			CreateRampEdgeLines(parent, name, val4, val2, width, magnitude);
		}

		private static void CreateRampEdgeLines(Transform parent, string rampName, Vector3 center, Quaternion rotation, float width, float length)
		{
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00c8: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			float num = width * 0.5f - 0.1f;
			float num2 = length * 0.5f - 0.1f;
			CreateRampLine(parent, rampName + " Left Edge", center, rotation, new Vector3(0f - num, 0.86f, 0f), new Vector3(0.2f, 0.05f, length));
			CreateRampLine(parent, rampName + " Right Edge", center, rotation, new Vector3(num, 0.86f, 0f), new Vector3(0.2f, 0.05f, length));
			CreateRampLine(parent, rampName + " Lower Edge", center, rotation, new Vector3(0f, 0.86f, 0f - num2), new Vector3(width, 0.05f, 0.2f));
			CreateRampLine(parent, rampName + " Upper Edge", center, rotation, new Vector3(0f, 0.86f, num2), new Vector3(width, 0.05f, 0.2f));
		}

		private static void CreateRampLine(Transform parent, string name, Vector3 center, Quaternion rotation, Vector3 localOffset, Vector3 size)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			CreateBox(parent, name, center + rotation * localOffset, size, GridMaterials.GridLineMaterial, solid: false).transform.localRotation = rotation;
		}

		private static void BuildBoostPads(Transform parent, GridMap map)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[9]
			{
				new Vector3(-30f, 0f, -30f),
				new Vector3(30f, 0f, -30f),
				new Vector3(-30f, 0f, 30f),
				new Vector3(30f, 0f, 30f),
				new Vector3(0f, 0f, -48f),
				new Vector3(0f, 0f, 48f),
				new Vector3(0f, 12f, 30f),
				new Vector3(0f, 12f, -30f),
				new Vector3(30f, 12f, 0f)
			};
			foreach (Vector3 val in array)
			{
				CreatePad(parent, "Boost Pad", val, GridMaterials.BoostMaterial);
				map.BoostPads.Add(val);
			}
		}

		private static void BuildJumpPads(Transform parent, GridMap map)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4]
			{
				new Vector3(-48f, 0f, 0f),
				new Vector3(48f, 0f, 0f),
				new Vector3(-20f, 0f, 0f),
				new Vector3(20f, 0f, 0f)
			};
			foreach (Vector3 val in array)
			{
				CreatePad(parent, "Jump Pad", val, GridMaterials.JumpMaterial);
				map.JumpPads.Add(val);
			}
		}

		private static void CreatePad(Transform parent, string name, Vector3 position, Material material)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			CreateBox(parent, name, position + new Vector3(0f, 0.06f, 0f), new Vector3(5.5f, 0.12f, 5.5f), material, solid: false).transform.localRotation = Quaternion.Euler(0f, 45f, 0f);
		}

		private static void BuildGridLines(Transform parent, float y, float half, float spacing)
		{
			//IL_0018: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.12f;
			for (float num2 = 0f - half; num2 <= half + 0.01f; num2 += spacing)
			{
				CreateBox(parent, "Grid Line X", new Vector3(num2, y, 0f), new Vector3(num, 0.04f, half * 2f), GridMaterials.GridLineMaterial, solid: false);
			}
			for (float num3 = 0f - half; num3 <= half + 0.01f; num3 += spacing)
			{
				CreateBox(parent, "Grid Line Z", new Vector3(0f, y, num3), new Vector3(half * 2f, 0.04f, num), GridMaterials.GridLineMaterial, solid: false);
			}
		}

		private static void BuildMajorGridLines(Transform parent, float y, float half, float spacing)
		{
			//IL_0018: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.24f;
			for (float num2 = 0f - half; num2 <= half + 0.01f; num2 += spacing)
			{
				CreateBox(parent, "Grid Line Major X", new Vector3(num2, y, 0f), new Vector3(num, 0.05f, half * 2f), GridMaterials.GridLineMajorMaterial, solid: false);
			}
			for (float num3 = 0f - half; num3 <= half + 0.01f; num3 += spacing)
			{
				CreateBox(parent, "Grid Line Major Z", new Vector3(0f, y, num3), new Vector3(half * 2f, 0.05f, num), GridMaterials.GridLineMajorMaterial, solid: false);
			}
		}

		private static void BuildDeckTrim(Transform parent, float y, float half)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_00ad: 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)
			float num = half - 0.6f;
			float num2 = 0.4f;
			CreateBox(parent, "Deck Trim North", new Vector3(0f, y, num), new Vector3(num * 2f, 0.06f, num2), GridMaterials.DeckTrimMaterial, solid: false);
			CreateBox(parent, "Deck Trim South", new Vector3(0f, y, 0f - num), new Vector3(num * 2f, 0.06f, num2), GridMaterials.DeckTrimMaterial, solid: false);
			CreateBox(parent, "Deck Trim East", new Vector3(num, y, 0f), new Vector3(num2, 0.06f, num * 2f), GridMaterials.DeckTrimMaterial, solid: false);
			CreateBox(parent, "Deck Trim West", new Vector3(0f - num, y, 0f), new Vector3(num2, 0.06f, num * 2f), GridMaterials.DeckTrimMaterial, solid: false);
		}

		private static void BuildWallTrim(Transform parent)
		{
			float topY = 8.7f;
			float bottomY = 0.3f;
			float num = 69.93f;
			BuildWallSideTrim(parent, "Wall Trim North", num, alongX: true, topY, bottomY);
			BuildWallSideTrim(parent, "Wall Trim South", 0f - num, alongX: true, topY, bottomY);
			BuildWallSideTrim(parent, "Wall Trim East", num, alongX: false, topY, bottomY);
			BuildWallSideTrim(parent, "Wall Trim West", 0f - num, alongX: false, topY, bottomY);
		}

		private static void BuildWallSideTrim(Transform parent, string name, float offset, bool alongX, float topY, float bottomY)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			float num = 140f;
			float num2 = (topY + bottomY) * 0.5f;
			float num3 = topY - bottomY;
			Vector3 size = (alongX ? new Vector3(num, 0.22f, 0.12f) : new Vector3(0.12f, 0.22f, num));
			Vector3 size2 = (alongX ? new Vector3(0.1f, num3, 0.12f) : new Vector3(0.12f, num3, 0.1f));
			Vector3 position = (alongX ? new Vector3(0f, topY, offset) : new Vector3(offset, topY, 0f));
			Vector3 position2 = (alongX ? new Vector3(0f, bottomY, offset) : new Vector3(offset, bottomY, 0f));
			CreateBox(parent, name + " Top Rail", position, size, GridMaterials.WallTrimMaterial, solid: false);
			CreateBox(parent, name + " Bottom Rail", position2, size, GridMaterials.WallTrimMaterial, solid: false);
			int num4 = 14;
			for (int i = 0; i <= num4; i++)
			{
				float num5 = ((float)i / (float)num4 * 2f - 1f) * 70f;
				Vector3 position3 = (alongX ? new Vector3(num5, num2, offset) : new Vector3(offset, num2, num5));
				CreateBox(parent, name + " Rib", position3, size2, GridMaterials.WallTrimMaterial, solid: false);
			}
		}

		private static void BuildCornerPillars(Transform parent)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			float num = 69.4f;
			float num2 = 14f;
			Vector3[] array = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(num, 0f, num),
				new Vector3(0f - num, 0f, num),
				new Vector3(num, 0f, 0f - num),
				new Vector3(0f - num, 0f, 0f - num),
				new Vector3(num, 0f, 0f),
				new Vector3(0f - num, 0f, 0f),
				new Vector3(0f, 0f, num),
				new Vector3(0f, 0f, 0f - num)
			};
			foreach (Vector3 val in array)
			{
				CreateBox(parent, "Grid Pillar", new Vector3(val.x, num2 * 0.5f, val.z), new Vector3(0.5f, num2, 0.5f), GridMaterials.PillarMaterial, solid: false);
			}
		}

		private static void BuildCenterRings(Transform parent, float y)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			BuildRing(parent, new Vector3(0f, y, 0f), 12f, 48, 0.3f, GridMaterials.GridLineMajorMaterial);
			BuildRing(parent, new Vector3(0f, y, 0f), 7f, 36, 0.22f, GridMaterials.GridLineMaterial);
		}

		private static void BuildRing(Transform parent, Vector3 center, float radius, int segments, float thickness, Material material)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < segments; i++)
			{
				float num = (float)i / (float)segments * MathF.PI * 2f;
				float num2 = (float)(i + 1) / (float)segments * MathF.PI * 2f;
				Vector3 val = center + new Vector3(Mathf.Cos(num) * radius, 0f, Mathf.Sin(num) * radius);
				Vector3 val2 = center + new Vector3(Mathf.Cos(num2) * radius, 0f, Mathf.Sin(num2) * radius);
				Vector3 val3 = val2 - val;
				CreateBox(parent, "Center Ring", (val + val2) * 0.5f, new Vector3(thickness, 0.05f, ((Vector3)(ref val3)).magnitude), material, solid: false).transform.localRotation = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up);
			}
		}

		private static void BuildHoleFrame(Transform parent)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0080: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			float num = 12.79f;
			float num2 = 13.4f;
			float num3 = 0.5f;
			CreateBox(parent, "Hole Frame North", new Vector3(0f, num, num2), new Vector3(num2 * 2f, 0.06f, num3), GridMaterials.GridLineMajorMaterial, solid: false);
			CreateBox(parent, "Hole Frame South", new Vector3(0f, num, 0f - num2), new Vector3(num2 * 2f, 0.06f, num3), GridMaterials.GridLineMajorMaterial, solid: false);
			CreateBox(parent, "Hole Frame East", new Vector3(num2, num, 0f), new Vector3(num3, 0.06f, num2 * 2f), GridMaterials.GridLineMajorMaterial, solid: false);
			CreateBox(parent, "Hole Frame West", new Vector3(0f - num2, num, 0f), new Vector3(num3, 0.06f, num2 * 2f), GridMaterials.GridLineMajorMaterial, solid: false);
		}

		private static void BuildLights(Transform parent)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[5]
			{
				new Vector3(-40f, 28f, -40f),
				new Vector3(40f, 28f, -40f),
				new Vector3(-40f, 28f, 40f),
				new Vector3(40f, 28f, 40f),
				new Vector3(0f, 34f, 0f)
			};
			foreach (Vector3 localPosition in array)
			{
				GameObject val = new GameObject("Grid Light");
				val.transform.SetParent(parent, false);
				val.transform.localPosition = localPosition;
				Light obj = val.AddComponent<Light>();
				obj.type = (LightType)2;
				obj.color = new Color(0.3f, 0.8f, 1f);
				obj.intensity = 2.2f;
				obj.range = 90f;
			}
		}

		private static void BuildSpawnPositions(GridMap map)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			int num = 8;
			float num2 = 26f;
			Vector3 item = default(Vector3);
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / (float)num * MathF.PI * 2f;
				((Vector3)(ref item))..ctor(Mathf.Cos(num3) * num2, 1f, Mathf.Sin(num3) * num2);
				map.SpawnPositions.Add(item);
			}
		}

		private static GameObject CreateBox(Transform parent, string name, Vector3 position, Vector3 size, Material material, bool solid)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val).name = name;
			val.transform.SetParent(parent, false);
			val.transform.localPosition = position;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = size;
			MeshRenderer component = val.GetComponent<MeshRenderer>();
			if ((Object)(object)component != (Object)null && (Object)(object)material != (Object)null)
			{
				((Renderer)component).sharedMaterial = material;
			}
			if (!solid)
			{
				Collider component2 = val.GetComponent<Collider>();
				if ((Object)(object)component2 != (Object)null)
				{
					Object.Destroy((Object)(object)component2);
				}
			}
			return val;
		}
	}
	internal static class GridMaterials
	{
		private static readonly Color[] RiderColors = (Color[])(object)new Color[8]
		{
			new Color(0.15f, 0.85f, 1f),
			new Color(1f, 0.45f, 0.1f),
			new Color(0.35f, 1f, 0.4f),
			new Color(1f, 0.2f, 0.55f),
			new Color(0.85f, 0.4f, 1f),
			new Color(1f, 0.92f, 0.2f),
			new Color(0.3f, 0.55f, 1f),
			new Color(1f, 0.3f, 0.25f)
		};

		public static Material DeckMaterial { get; private set; }

		public static Material DeckTrimMaterial { get; private set; }

		public static Material GridLineMaterial { get; private set; }

		public static Material GridLineMajorMaterial { get; private set; }

		public static Material WallMaterial { get; private set; }

		public static Material WallTrimMaterial { get; private set; }

		public static Material RampMaterial { get; private set; }

		public static Material BoostMaterial { get; private set; }

		public static Material JumpMaterial { get; private set; }

		public static Material PillarMaterial { get; private set; }

		public static void EnsureCreated()
		{
			//IL_0022: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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 refe