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 ForceGridLevel; public readonly ConfigEntry CountdownSeconds; public readonly ConfigEntry CruiseSpeed; public readonly ConfigEntry BoostSpeed; public readonly ConfigEntry TurnRate; public readonly ConfigEntry TrailLifetime; public readonly ConfigEntry 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("Debug", "ForceGridLevel", false, "Forces every real run level to load Empress - The Grid. Useful for testing."); CountdownSeconds = config.Bind("Match", "CountdownSeconds", 10, new ConfigDescription("Countdown length before the riders are released.", (AcceptableValueBase)(object)new AcceptableValueRange(3, 30), Array.Empty())); CruiseSpeed = config.Bind("Cycle", "CruiseSpeed", 18f, new ConfigDescription("Constant forward speed of a light cycle in meters per second.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 40f), Array.Empty())); BoostSpeed = config.Bind("Cycle", "BoostSpeed", 24f, new ConfigDescription("Forward speed while holding boost.", (AcceptableValueBase)(object)new AcceptableValueRange(8f, 55f), Array.Empty())); TurnRate = config.Bind("Cycle", "TurnRate", 130f, new ConfigDescription("Steering rate in degrees per second.", (AcceptableValueBase)(object)new AcceptableValueRange(40f, 260f), Array.Empty())); TrailLifetime = config.Bind("Cycle", "TrailLifetime", 5f, new ConfigDescription("Seconds before the tail of a light trail fades away.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 20f), Array.Empty())); WinExitDelay = config.Bind("Match", "WinExitDelay", 6f, new ConfigDescription("Seconds after a winner is decided before the level transitions away.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 30f), Array.Empty())); } } 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(ModuleSetAllChecklistMethod); private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate(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(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(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>(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(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(MethodInfo method) where TDelegate : Delegate { if (method == null) { return null; } return AccessTools.MethodDelegate(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(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 _hiddenAvatarRenderers = new List(); 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(); _glow.type = (LightType)2; _glow.color = Color; _glow.intensity = 2.4f; _glow.range = 8f; _engine = val.AddComponent(); _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(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = obj.GetComponent(); 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(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(); } 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 LevelContentLevelRef = AccessTools.FieldRefAccess("_level"); private static readonly FieldRef> LevelContentStartRoomsRef = AccessTools.FieldRefAccess>("_startRooms"); private static readonly FieldRef> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess>("_modulesNormal1"); private static readonly FieldRef> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess>("_modulesNormal2"); private static readonly FieldRef> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess>("_modulesNormal3"); private static readonly FieldRef> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess>("_modulesPassage1"); private static readonly FieldRef> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess>("_modulesPassage2"); private static readonly FieldRef> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess>("_modulesPassage3"); private static readonly FieldRef> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess>("_modulesDeadEnd1"); private static readonly FieldRef> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess>("_modulesDeadEnd2"); private static readonly FieldRef> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess>("_modulesDeadEnd3"); private static readonly FieldRef> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess>("_modulesExtraction1"); private static readonly FieldRef> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess>("_modulesExtraction2"); private static readonly FieldRef> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess>("_modulesExtraction3"); private static readonly FieldRef LevelContentConnectObjectRef = AccessTools.FieldRefAccess("_connectObject"); private static readonly FieldRef LevelContentBlockObjectRef = AccessTools.FieldRefAccess("_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(); ((Object)val).name = "Level - Empress The Grid"; val.NarrativeName = "Empress - The Grid"; LevelValuables val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "Valuables - Empress The Grid"; val2.tiny = new List(); val2.small = new List(); val2.medium = new List(); val2.big = new List(); val2.wide = new List(); val2.tall = new List(); val2.veryTall = new List(); SetLevelField(val, "ModuleAmount", 0); SetLevelField(val, "PassageMaxAmount", 0); SetLevelField(val, "HasEnemies", false); SetLevelField(val, "ValuablePresets", new List { val2 }); SetLevelField(val, "AmbiencePresets", new List()); 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(); ((Object)val3).name = "Empress The Grid Content"; LevelContentLevelRef.Invoke(val3) = val; LevelContentStartRoomsRef.Invoke(val3) = new List(); LevelContentModulesNormal1Ref.Invoke(val3) = new List(); LevelContentModulesNormal2Ref.Invoke(val3) = new List(); LevelContentModulesNormal3Ref.Invoke(val3) = new List(); LevelContentModulesPassage1Ref.Invoke(val3) = new List(); LevelContentModulesPassage2Ref.Invoke(val3) = new List(); LevelContentModulesPassage3Ref.Invoke(val3) = new List(); LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List(); LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List(); LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List(); LevelContentModulesExtraction1Ref.Invoke(val3) = new List(); LevelContentModulesExtraction2Ref.Invoke(val3) = new List(); LevelContentModulesExtraction3Ref.Invoke(val3) = new List(); 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 _verticals = new List(); private readonly List _horizontals = new List(); 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(); GridLoadingScreen gridLoadingScreen = val.AddComponent(); 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(); ((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(); 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 BoostPads = new List(); public readonly List JumpPads = new List(); public readonly List SpawnPositions = new List(); 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(); 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(); if ((Object)(object)component != (Object)null && (Object)(object)material != (Object)null) { ((Renderer)component).sharedMaterial = material; } if (!solid) { Collider component2 = val.GetComponent(); 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 references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)DeckMaterial != (Object)null)) { DeckMaterial = CreateOpaqueMetallic(new Color(0.004f, 0.006f, 0.009f, 1f), 0.9f, 0.94f); DeckTrimMaterial = CreateAdditive(new Color(0.25f, 0.9f, 1f), 5f); GridLineMaterial = CreateAdditive(new Color(0.2f, 0.85f, 1f), 3.6f); GridLineMajorMaterial = CreateAdditive(new Color(0.5f, 0.97f, 1f), 6.5f); WallMaterial = CreateGlass(new Color(0.04f, 0.22f, 0.42f, 0.2f), new Color(0.12f, 0.6f, 0.95f), 1.6f); WallTrimMaterial = CreateAdditive(new Color(0.3f, 0.85f, 1f), 6f); RampMaterial = CreateOpaqueMetallic(new Color(0.006f, 0.009f, 0.013f, 1f), 0.85f, 0.9f); BoostMaterial = CreateAdditive(new Color(1f, 0.8f, 0.12f), 6f); JumpMaterial = CreateAdditive(new Color(1f, 0.22f, 0.6f), 6f); PillarMaterial = CreateAdditive(new Color(0.25f, 0.85f, 1f), 4.5f); } } public static Color RiderColor(int index) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (index < 0) { index = 0; } return RiderColors[index % RiderColors.Length]; } public static Material CreateTrailMaterial(Color color) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Color baseColor = color; baseColor.a = 0.5f; Material val = CreateTransparent(baseColor, color, 3f); if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.85f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.3f); } return val; } public static Material CreateTrailBodyMaterial(Color color) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Color baseColor = color; baseColor.a = 0.4f; Material val = CreateTransparent(baseColor, color, 2.6f); if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } return val; } public static Material CreateTrailCapMaterial(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return CreateAdditive(color, 6f); } public static Material CreateBikeMaterial(Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: 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_0075: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = color; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.55f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.85f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", color * 3.2f); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } return val; } private static Material CreateOpaqueMetallic(Color color, float metallic, float glossiness) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.SetFloat("_Mode", 0f); val.SetInt("_SrcBlend", 1); val.SetInt("_DstBlend", 0); val.SetInt("_ZWrite", 1); val.DisableKeyword("_ALPHATEST_ON"); val.DisableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.renderQueue = -1; val.color = color; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", glossiness); } return val; } public static Material CreateTransparent(Color baseColor, Color emissionColor, float emissionStrength) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.renderQueue = 3000; val.color = baseColor; if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.6f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.1f); } if (emissionStrength > 0f && val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", emissionColor * emissionStrength); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } return val; } private static Material CreateGlass(Color baseColor, Color emissionColor, float emissionStrength) { //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) Material val = CreateTransparent(baseColor, emissionColor, emissionStrength); if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.92f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.25f); } return val; } private static Material CreateAdditive(Color glow, float strength) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0085: 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_00dc: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 1); val.SetInt("_DstBlend", 1); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.renderQueue = 3100; val.color = new Color(0f, 0f, 0f, 1f); if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", glow * strength); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; return val; } } [HarmonyPatch(typeof(RunManager), "SetRunLevel")] internal static class GridPatchRunManagerSetRunLevel { private static void Postfix(RunManager __instance) { if (EmpressTheGridPlugin.Settings != null && EmpressTheGridPlugin.Settings.ForceGridLevel.Value && !((Object)(object)EmpressTheGridPlugin.GridLevel == (Object)null)) { __instance.levelCurrent = EmpressTheGridPlugin.GridLevel; } } } [HarmonyPatch(typeof(LevelGenerator), "Generate")] internal static class GridPatchLevelGeneratorGenerate { private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result) { if (!EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = GridRuntime.EnsureHost().GenerateGridLevel(__instance); return false; } } [HarmonyPatch(typeof(LevelPoint), "NavMeshCheck")] internal static class GridPatchLevelPointNavMeshCheck { private static bool Prefix(ref IEnumerator __result) { if (!EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = GridRuntime.EmptyCoroutine(); return false; } } [HarmonyPatch(typeof(EnvironmentDirector), "Setup")] internal static class GridPatchEnvironmentDirectorSetup { private static bool Prefix(EnvironmentDirector __instance) { //IL_002d: 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_004b: 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_0077: 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) if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { return true; } Level level = LevelGenerator.Instance.Level; if (!Object.op_Implicit((Object)(object)level) || !EmpressTheGridPlugin.IsGridLevel(level)) { return true; } GridAccess.SetEnvironmentFog(__instance, level.FogColor, level.FogStartDistance, level.FogEndDistance); GridAccess.SetEnvironmentAmbient(__instance, level.AmbientColor, level.AmbientColorAdaptation); RenderSettings.fogColor = level.FogColor; RenderSettings.fogStartDistance = level.FogStartDistance; RenderSettings.fogEndDistance = level.FogEndDistance; RenderSettings.ambientLight = level.AmbientColor; Camera val = GridAccess.GetEnvironmentMainCamera(__instance); if (!Object.op_Implicit((Object)(object)val)) { val = Camera.main; GridAccess.SetEnvironmentMainCamera(__instance, val); } if (Object.op_Implicit((Object)(object)val)) { val.backgroundColor = RenderSettings.fogColor; val.farClipPlane = RenderSettings.fogEndDistance + 8f; } GridAccess.SetEnvironmentDarkAdaptation(__instance, 0.1f); GridAccess.SetEnvironmentSetupDone(__instance, value: true); return false; } } [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class GridPatchLoadingUiLevelAnimationStart { private static void Postfix(LoadingUI __instance) { //IL_005d: 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) bool flag = EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.Level : null); GridLoadingScreen.Apply(__instance, flag); if (flag) { if ((Object)(object)__instance.levelNumberText != (Object)null) { ((TMP_Text)__instance.levelNumberText).text = "ENTER"; ((Graphic)__instance.levelNumberText).color = new Color(0.4f, 0.95f, 1f); ((Component)__instance.levelNumberText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNumberText).transform.SetAsLastSibling(); } if ((Object)(object)__instance.levelNameText != (Object)null) { ((TMP_Text)__instance.levelNameText).text = "Empress - The Grid"; ((Graphic)__instance.levelNameText).color = new Color(0.5f, 1f, 0.7f); ((Component)__instance.levelNameText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNameText).transform.SetAsLastSibling(); } } } } [HarmonyPatch(typeof(ItemManager), "TurnOffIconLights")] internal static class GridPatchItemManagerTurnOffIconLights { private static bool Prefix(ItemManager __instance, ref IEnumerator __result) { if (!EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = SafeTurnOffIconLights(__instance); return false; } private static IEnumerator SafeTurnOffIconLights(ItemManager itemManager) { if ((Object)(object)itemManager.itemIconLights == (Object)null) { yield break; } if (SemiFunc.RunIsShop() || SemiFunc.MenuLevel()) { itemManager.itemIconLights.SetActive(false); yield break; } while ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { yield return (object)new WaitForSeconds(0.2f); } while (itemManager.spawnedItems != null) { itemManager.spawnedItems.RemoveAll((ItemAttributes item) => (Object)(object)item == (Object)null); bool flag = false; for (int i = 0; i < itemManager.spawnedItems.Count; i++) { ItemAttributes val = itemManager.spawnedItems[i]; if ((Object)(object)val != (Object)null && !GridAccess.GetItemHasIcon(val)) { flag = true; break; } } if (!flag) { break; } yield return (object)new WaitForSeconds(0.2f); } itemManager.itemIconLights.SetActive(false); } } [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] internal static class GridPatchPlayerControllerFixedUpdate { private static bool Prefix(PlayerController __instance) { GridRuntime instance = GridRuntime.Instance; if ((Object)(object)instance == (Object)null) { return true; } return !instance.TryDriveLocalPlayer(__instance); } } [HarmonyPatch(typeof(CameraAim), "Update")] internal static class GridPatchCameraAimUpdate { private static void Postfix() { GridRuntime instance = GridRuntime.Instance; if ((Object)(object)instance != (Object)null && instance.LocalDriving) { instance.ApplyCameraHeading(); } } } [HarmonyPatch(typeof(PlayerTumble), "TumbleRequest")] internal static class GridPatchPlayerTumbleRequest { private static bool Prefix(bool _isTumbling) { if (!_isTumbling) { return true; } return !EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null); } } [HarmonyPatch(typeof(PlayerTumble), "ImpactHurtSet")] internal static class GridPatchPlayerTumbleImpactHurtSet { private static bool Prefix() { return !EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null); } } internal enum GridPhase { Waiting, Countdown, Racing, Finished } internal sealed class GridRuntime : MonoBehaviour { private struct StuckSample { public Vector3 Position; public float Time; } private const float Gravity = 26f; private const float CollisionRadius = 0.9f; private const int SelfSkipPoints = 38; private const float RaceArmSeconds = 1.2f; private const float JumpVelocity = 14f; private const float GroundProbe = 1.7f; private readonly List _cycles = new List(); private readonly Dictionary _cyclesByViewId = new Dictionary(); private readonly Dictionary _stuckSamples = new Dictionary(); private GridHud _hud; private AudioSource _music; private GridMap _map; private Transform _gridRoot; private Transform _trailRoot; private LevelGenerator _generator; private int _sceneHandle = -1; private bool _active; private GridPhase _phase; private bool _countdownStarted; private double _countdownEndTime; private float _winTimer; private float _heading; private float _speed; private float _boostTimer; private float _jumpCooldown; private float _pendingJumpVelocity; private bool _localEliminated; private float _flashlightTimer; private float _raceArmTimer; private bool _hudShown; public static GridRuntime Instance { get; private set; } public float LocalHeading => _heading; public bool LocalDriving { get { if (_active && !_localEliminated) { if (_phase != GridPhase.Countdown) { return _phase == GridPhase.Racing; } return true; } return false; } } public static GridRuntime EnsureHost() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("Empress The Grid Runtime"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent(); return Instance; } public static IEnumerator EmptyCoroutine() { yield break; } private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Instance = this; _hud = GridHud.Create(); _hud.SetVisible(visible: false); GameObject val = new GameObject("Empress Grid Music"); val.transform.SetParent(((Component)this).transform, false); _music = val.AddComponent(); _music.loop = true; _music.playOnAwake = false; _music.spatialBlend = 0f; _music.volume = 0.3f; } private void Update() { HandleSceneTransition(); if (!_active) { return; } if (!EmpressTheGridPlugin.IsGridLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { Deactivate(); return; } EnsureCycles(); _flashlightTimer -= Time.deltaTime; if (_flashlightTimer <= 0f) { _flashlightTimer = 1f; DisableFlashlights(); } RevealHudWhenReady(); MaybeBeginCountdown(); UpdatePhase(); SampleCycles(); if (SemiFunc.IsMasterClientOrSingleplayer() && _phase == GridPhase.Racing) { HostCollisionAndWin(); } UpdateHud(); UpdateWinExit(); } public bool TryDriveLocalPlayer(PlayerController controller) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 if (!_active || (Object)(object)controller == (Object)null || (Object)(object)controller != (Object)(object)PlayerController.instance) { return false; } if (_map == null) { return false; } if ((Object)(object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2) { return false; } PlayerAvatar playerAvatarScript = controller.playerAvatarScript; if ((Object)(object)playerAvatarScript == (Object)null || GridAccess.GetIsTumbling(playerAvatarScript) || GridAccess.GetDeadSet(playerAvatarScript)) { return false; } if (_localEliminated) { return false; } if (_phase == GridPhase.Countdown) { DriveCountdown(controller); return true; } if (_phase == GridPhase.Racing) { DriveRacing(controller); return true; } return false; } private void DriveCountdown(PlayerController controller) { //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_00ab: Unknown result type (might be due to invalid IL or missing references) Rigidbody rb = controller.rb; if ((Object)(object)rb == (Object)null) { return; } float fixedDeltaTime = Time.fixedDeltaTime; bool num = SemiFunc.NoTextInputsActive(); float num2 = 0f; if (num) { if (Input.GetKey((KeyCode)97)) { num2 -= 1f; } if (Input.GetKey((KeyCode)100)) { num2 += 1f; } } _heading += num2 * EmpressTheGridPlugin.Settings.TurnRate.Value * fixedDeltaTime; ((Component)controller).transform.rotation = Quaternion.Euler(0f, _heading, 0f); Vector3 velocity = default(Vector3); ((Vector3)(ref velocity))..ctor(0f, rb.velocity.y - 26f * fixedDeltaTime, 0f); rb.velocity = velocity; _speed = 0f; } private void DriveRacing(PlayerController controller) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) Rigidbody rb = controller.rb; if ((Object)(object)rb == (Object)null) { return; } GridSettings settings = EmpressTheGridPlugin.Settings; float fixedDeltaTime = Time.fixedDeltaTime; bool num = SemiFunc.NoTextInputsActive(); float num2 = 0f; bool flag = false; if (num) { if (Input.GetKey((KeyCode)97)) { num2 -= 1f; } if (Input.GetKey((KeyCode)100)) { num2 += 1f; } if (Input.GetKey((KeyCode)119)) { flag = true; } } float num3 = Mathf.Clamp01(_speed / Mathf.Max(1f, settings.BoostSpeed.Value)); float num4 = settings.TurnRate.Value * (1f + (1f - num3) * 0.4f); _heading += num2 * num4 * fixedDeltaTime; float num5 = (flag ? settings.BoostSpeed.Value : settings.CruiseSpeed.Value); Vector3 position = ((Component)controller).transform.position; ApplyBoostPads(position); if (_boostTimer > 0f) { num5 = Mathf.Max(num5, settings.BoostSpeed.Value * 1.35f); _boostTimer -= fixedDeltaTime; } _speed = Mathf.MoveTowards(_speed, Mathf.Max(settings.CruiseSpeed.Value, num5), 24f * fixedDeltaTime); Vector3 normal; bool flag2 = GroundInfo(position, out normal); ApplyJumpPads(position, flag2); Quaternion val = Quaternion.Euler(0f, _heading, 0f); ((Component)controller).transform.rotation = val; Vector3 val2 = val * Vector3.forward; if (_jumpCooldown > 0f) { _jumpCooldown -= fixedDeltaTime; } Vector3 velocity; if (flag2 && _pendingJumpVelocity <= 0f) { Vector3 val3 = Vector3.ProjectOnPlane(val2, normal); Vector3 val4 = ((Vector3)(ref val3)).normalized; if (((Vector3)(ref val4)).sqrMagnitude < 0.001f) { val4 = val2; } velocity = val4 * _speed; } else { velocity = val2 * _speed; velocity.y = rb.velocity.y - 26f * fixedDeltaTime; if (_pendingJumpVelocity > 0f) { velocity.y = _pendingJumpVelocity; _pendingJumpVelocity = 0f; } } rb.velocity = velocity; } private void ApplyBoostPads(Vector3 position) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _map.BoostPads.Count; i++) { Vector3 val = _map.BoostPads[i]; if (!(Mathf.Abs(position.y - val.y) > 3.5f)) { float num = position.x - val.x; float num2 = position.z - val.z; if (num * num + num2 * num2 <= _map.BoostRadius * _map.BoostRadius) { _boostTimer = 2.5f; break; } } } } private void ApplyJumpPads(Vector3 position, bool grounded) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) if (!grounded || _jumpCooldown > 0f) { return; } for (int i = 0; i < _map.JumpPads.Count; i++) { Vector3 val = _map.JumpPads[i]; if (!(Mathf.Abs(position.y - val.y) > 3.5f)) { float num = position.x - val.x; float num2 = position.z - val.z; if (num * num + num2 * num2 <= _map.JumpRadius * _map.JumpRadius) { _pendingJumpVelocity = 14f; _jumpCooldown = 1.2f; break; } } } } private static bool GroundInfo(Vector3 position, out Vector3 normal) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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) normal = Vector3.up; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 0.5f, Vector3.down, ref val, 1.7f, -1, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent() == (Object)null) { normal = ((RaycastHit)(ref val)).normal; return true; } return false; } public void ApplyCameraHeading() { if (LocalDriving) { CameraAim instance = CameraAim.Instance; if (!((Object)(object)instance == (Object)null)) { float cameraVertical = GridAccess.GetCameraVertical(instance); cameraVertical = Mathf.Clamp(cameraVertical, -10f, 35f); GridAccess.SetCameraHeading(instance, _heading, cameraVertical); } } } public IEnumerator GenerateGridLevel(LevelGenerator generator) { _generator = generator; EmpressTheGridPlugin.EnsurePhotonEventHooked(); yield return (object)new WaitForSeconds(0.2f); if (!SemiFunc.IsMultiplayer()) { GridAccess.SetAllPlayersReady(generator, value: true); } while (!GridAccess.GetAllPlayersReady(generator)) { generator.State = (LevelState)1; yield return (object)new WaitForSeconds(0.1f); } yield return (object)new WaitForSeconds(0.2f); generator.Level = RunManager.instance.levelCurrent; GridAccess.SetLevelPrevious(RunManager.instance, generator.Level); generator.Generated = false; GridAccess.SetEnemyReady(generator, value: true); GridAccess.SetModulesSpawned(generator, 0); GridAccess.SetPlayerSpawnedCount(generator, 0); generator.LevelPathPoints = new List(); generator.LevelPathTruck = null; if (Object.op_Implicit((Object)(object)ValuableDirector.instance)) { GridAccess.SetValuableSetupComplete(ValuableDirector.instance, value: true); GridAccess.SetValuableValuablesSpawned(ValuableDirector.instance, value: true); } if (Object.op_Implicit((Object)(object)RoundDirector.instance)) { GridAccess.ResetRoundExtraction(RoundDirector.instance); } generator.State = (LevelState)3; BuildGrid(generator); GridRuntime gridRuntime = this; Scene activeScene = SceneManager.GetActiveScene(); gridRuntime._sceneHandle = ((Scene)(ref activeScene)).handle; yield return (object)new WaitForSeconds(0.2f); if (Object.op_Implicit((Object)(object)EnvironmentDirector.Instance)) { EnvironmentDirector.Instance.Setup(); } if (Object.op_Implicit((Object)(object)PostProcessing.Instance)) { PostProcessing.Instance.Setup(); } if (Object.op_Implicit((Object)(object)LevelMusic.instance)) { LevelMusic.instance.Setup(); } if (Object.op_Implicit((Object)(object)ConstantMusic.instance)) { ConstantMusic.instance.Setup(); } GridVisuals.Apply(_gridRoot); if (SemiFunc.IsMasterClientOrSingleplayer()) { NavMeshSurface component = ((Component)generator).GetComponent(); if ((Object)(object)component != (Object)null) { component.collectObjects = (CollectObjects)0; component.useGeometry = (NavMeshCollectGeometry)1; component.layerMask = LayerMask.op_Implicit(-1); component.defaultArea = 0; } generator.NavMeshSetup(); yield return null; while ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList.Count == 0) { generator.State = (LevelState)12; yield return (object)new WaitForSeconds(0.1f); } generator.PlayerSpawn(); yield return null; while (GridAccess.GetPlayerSpawnedCount(generator) < GameDirector.instance.PlayerList.Count) { generator.State = (LevelState)13; yield return (object)new WaitForSeconds(0.1f); } if (SemiFunc.IsMultiplayer()) { generator.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty()); } else { GridAccess.GenerateDone(generator); } } else { while (!generator.Generated) { yield return (object)new WaitForSeconds(0.1f); } } yield return (object)new WaitForSeconds(0.5f); Activate(); } private void BuildGrid(LevelGenerator generator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown if ((Object)(object)generator.LevelParent != (Object)null) { for (int num = generator.LevelParent.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)generator.LevelParent.transform.GetChild(num)).gameObject); } } GameObject val = new GameObject("Empress Grid Root"); val.transform.SetParent(generator.LevelParent.transform, false); _gridRoot = val.transform; GameObject val2 = new GameObject("Empress Grid Module"); val2.transform.SetParent(val.transform, false); val2.AddComponent().ObservedComponents = new List(); GridAccess.ConfigureStartRoomModule(val2.AddComponent(), 0, 0); val2.AddComponent(); GameObject val3 = new GameObject("Empress Grid Room Volume"); val3.transform.SetParent(val2.transform, false); RoomVolume roomVolume = val3.AddComponent(); BoxCollider obj = val3.AddComponent(); ((Collider)obj).isTrigger = true; obj.size = new Vector3(180f, 60f, 180f); obj.center = new Vector3(0f, 20f, 0f); _map = GridMapBuilder.Build(val2.transform); GameObject val4 = new GameObject("Empress Grid Trails"); val4.transform.SetParent(val.transform, false); _trailRoot = val4.transform; BuildSpawnPoints(val2.transform, roomVolume, generator); } private void BuildSpawnPoints(Transform parent, RoomVolume roomVolume, LevelGenerator generator) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_00b7: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = default(Vector3); for (int i = 0; i < _map.SpawnPositions.Count; i++) { Vector3 val = _map.SpawnPositions[i]; GameObject val2 = new GameObject("Empress Grid Spawn"); val2.transform.SetParent(parent, false); val2.transform.localPosition = val; ((Vector3)(ref forward))..ctor(val.x, 0f, val.z); if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { forward = Vector3.forward; } val2.transform.localRotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized, Vector3.up); val2.AddComponent(); } LevelPoint val3 = CreateLevelPoint(parent, roomVolume, generator, new Vector3(0f, 1f, 0f), truck: true); LevelPoint val4 = CreateLevelPoint(parent, roomVolume, generator, new Vector3(0f, 1f, 20f), truck: false); val3.ConnectedPoints = new List { val4 }; val4.ConnectedPoints = new List { val3 }; } private static LevelPoint CreateLevelPoint(Transform parent, RoomVolume roomVolume, LevelGenerator generator, Vector3 localPosition, bool truck) { //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_001a: 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_002d: 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) GameObject val = new GameObject("Empress Grid Level Point") { layer = LayerMask.NameToLayer("Other") }; val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; SphereCollider obj = val.AddComponent(); ((Collider)obj).isTrigger = true; obj.radius = 0.35f; LevelPoint obj2 = val.AddComponent(); obj2.ConnectedPoints = new List(); obj2.Room = roomVolume; obj2.Truck = truck; obj2.ModuleConnect = false; GridAccess.MarkLevelPointInStartRoom(obj2, value: true); if (generator.LevelPathPoints == null) { generator.LevelPathPoints = new List(); } return obj2; } private void Activate() { //IL_0093: 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) _active = true; _localEliminated = false; _winTimer = 0f; _speed = 0f; _boostTimer = 0f; _jumpCooldown = 0f; _pendingJumpVelocity = 0f; PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null) { _heading = ((Component)instance).transform.eulerAngles.y; } _hud.HideRepoHud(); _hud.SetVisible(visible: false); _hudShown = false; _hud.SetBanner(string.Empty, Color.white); _hud.SetCountdown(string.Empty); _flashlightTimer = 0f; DisableFlashlights(); EnsureCycles(); StartMusic(); EmpressTheGridPlugin.Log.LogInfo((object)("Empress The Grid activated (" + (SemiFunc.IsMasterClientOrSingleplayer() ? "host" : "client") + ").")); } private void StartMusic() { if (!((Object)(object)_music == (Object)null) && !((Object)(object)GridAudio.MusicClip == (Object)null)) { if ((Object)(object)_music.clip != (Object)(object)GridAudio.MusicClip) { _music.clip = GridAudio.MusicClip; } _music.volume = 0.3f; if (!_music.isPlaying) { _music.Play(); } } } private void StopMusic() { if ((Object)(object)_music != (Object)null && _music.isPlaying) { _music.Stop(); } } private void Deactivate() { if (_active) { _active = false; _phase = GridPhase.Waiting; _countdownStarted = false; _raceArmTimer = 0f; _stuckSamples.Clear(); StopMusic(); ClearCycles(); RestoreFlashlights(); GridVisuals.Restore(); _hud.SetVisible(visible: false); _hud.ShowRepoHud(); _map = null; _gridRoot = null; _trailRoot = null; } } private static void DisableFlashlights() { FlashlightController[] array = Object.FindObjectsOfType(); foreach (FlashlightController val in array) { if (!((Object)(object)val == (Object)null)) { if ((Object)(object)val.spotlight != (Object)null) { ((Behaviour)val.spotlight).enabled = false; } ((Behaviour)val).enabled = false; } } } private static void RestoreFlashlights() { FlashlightController[] array = Object.FindObjectsOfType(); foreach (FlashlightController val in array) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = true; } } } private void HandleSceneTransition() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); int handle = ((Scene)(ref activeScene)).handle; if (handle != _sceneHandle) { _sceneHandle = handle; if (_active) { Deactivate(); return; } ClearCycles(); _hud.SetVisible(visible: false); _hud.ShowRepoHud(); } } private void RevealHudWhenReady() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!_hudShown && LoadingFinished()) { _hudShown = true; _hud.SetVisible(visible: true); if (_phase == GridPhase.Waiting) { _hud.SetBanner("GET READY", new Color(0.5f, 0.95f, 1f)); } } } private static bool LoadingFinished() { LoadingUI instance = LoadingUI.instance; if ((Object)(object)instance == (Object)null) { return true; } return !((Component)instance).gameObject.activeInHierarchy; } private void MaybeBeginCountdown() { if (!_countdownStarted && _phase == GridPhase.Waiting && LevelReady() && LoadingFinished()) { _countdownStarted = true; _countdownEndTime = Now() + (double)EmpressTheGridPlugin.Settings.CountdownSeconds.Value; _phase = GridPhase.Countdown; if (SemiFunc.IsMasterClientOrSingleplayer()) { EmpressTheGridPlugin.ClearGridPhotonCache(); EmpressTheGridPlugin.RaiseStart(_countdownEndTime); } EmpressTheGridPlugin.Log.LogInfo((object)("Empress The Grid countdown started (" + (SemiFunc.IsMasterClientOrSingleplayer() ? "host" : "client") + ").")); } } private static bool LevelReady() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if ((Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && (Object)(object)GameDirector.instance != (Object)null) { return (int)GameDirector.instance.currentState == 2; } return false; } internal void ReceiveStart(double endTime) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { _countdownEndTime = endTime; _countdownStarted = true; _active = true; if (_phase == GridPhase.Waiting) { _phase = GridPhase.Countdown; } } } internal void ReceiveEliminated(int viewId) { EliminateCycle(viewId, broadcast: false); } internal void ReceiveWin(int viewId) { FinishMatch(viewId, broadcast: false); } private void UpdatePhase() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (_phase == GridPhase.Countdown && Now() >= _countdownEndTime) { _phase = GridPhase.Racing; _speed = EmpressTheGridPlugin.Settings.CruiseSpeed.Value; _raceArmTimer = 1.2f; for (int i = 0; i < _cycles.Count; i++) { _cycles[i].SetRecording(recording: true); } _hud.SetBanner(string.Empty, Color.white); } } private void SampleCycles() { for (int i = 0; i < _cycles.Count; i++) { GridCycle gridCycle = _cycles[i]; if (gridCycle.IsValid) { gridCycle.Sample(); } } } private void HostCollisionAndWin() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (_raceArmTimer > 0f) { _raceArmTimer -= Time.deltaTime; return; } for (int i = 0; i < _cycles.Count; i++) { GridCycle gridCycle = _cycles[i]; if (gridCycle.Eliminated || !gridCycle.IsValid) { continue; } if (GridAccess.GetIsDisabled(gridCycle.Avatar) || GridAccess.GetDeadSet(gridCycle.Avatar)) { EliminateCycle(gridCycle.ViewId, broadcast: true); continue; } if (IsStuckOnWall(gridCycle)) { EliminateCycle(gridCycle.ViewId, broadcast: true); continue; } Vector3 position = gridCycle.Position + Vector3.up * 0.6f; for (int j = 0; j < _cycles.Count; j++) { GridCycle gridCycle2 = _cycles[j]; if (gridCycle2.IsValid) { int skipNewestCount = ((gridCycle2 == gridCycle) ? 38 : 0); if (gridCycle2.TrailIntersects(position, 0.9f, skipNewestCount)) { EliminateCycle(gridCycle.ViewId, broadcast: true); break; } } } } CheckWinCondition(); } private bool IsStuckOnWall(GridCycle cycle) { //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_0038: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_009e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = cycle.Position; float time = Time.time; if (!_stuckSamples.TryGetValue(cycle.ViewId, out var value)) { _stuckSamples[cycle.ViewId] = new StuckSample { Position = position, Time = time }; return false; } if (time - value.Time < 0.5f) { return false; } Vector3 val = position - value.Position; val.y = 0f; bool result = ((Vector3)(ref val)).magnitude < 1.5f; _stuckSamples[cycle.ViewId] = new StuckSample { Position = position, Time = time }; return result; } private void CheckWinCondition() { if (_phase != GridPhase.Racing) { return; } int count = _cycles.Count; int num = 0; int num2 = -1; for (int i = 0; i < _cycles.Count; i++) { if (!_cycles[i].Eliminated) { num++; num2 = _cycles[i].ViewId; } } if (count >= 2 && num <= 1) { FinishMatch((num == 1) ? num2 : (-1), broadcast: true); } else if (count == 1 && num == 0) { FinishMatch(-1, broadcast: true); } } private void EliminateCycle(int viewId, bool broadcast) { //IL_0021: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (_cyclesByViewId.TryGetValue(viewId, out var value) && !value.Eliminated) { value.Eliminate(); SpawnExplosion(value.Position, value.Color); if (value.IsLocal) { _localEliminated = true; _hud.SetBanner("ELIMINATED", new Color(1f, 0.4f, 0.35f)); SelfDestructLocalPlayer(value.Avatar); } if (broadcast && SemiFunc.IsMasterClientOrSingleplayer()) { EmpressTheGridPlugin.RaiseEliminated(viewId); } } } private void FinishMatch(int winnerViewId, bool broadcast) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (_phase == GridPhase.Finished) { return; } _phase = GridPhase.Finished; _winTimer = EmpressTheGridPlugin.Settings.WinExitDelay.Value; for (int i = 0; i < _cycles.Count; i++) { _cycles[i].SetRecording(recording: false); } GridCycle value; if (winnerViewId < 0) { _hud.SetBanner("GAME OVER", new Color(1f, 0.5f, 0.4f)); } else if (_cyclesByViewId.TryGetValue(winnerViewId, out value)) { if (value.IsLocal) { _hud.SetBanner("YOU WIN", new Color(0.5f, 1f, 0.6f)); } else { _hud.SetBanner(GridAccess.GetPlayerName(value.Avatar).ToUpperInvariant() + " WINS", value.Color); } } if (broadcast && SemiFunc.IsMasterClientOrSingleplayer()) { EmpressTheGridPlugin.RaiseWin(winnerViewId); } } private void UpdateWinExit() { if (_phase != GridPhase.Finished || _winTimer > 900f) { return; } _winTimer -= Time.unscaledDeltaTime; if (!(_winTimer > 0f)) { _winTimer = 999f; if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)RunManager.instance != (Object)null) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } } private void UpdateHud() { if (_phase == GridPhase.Countdown) { double num = _countdownEndTime - Now(); if (num > (double)EmpressTheGridPlugin.Settings.CountdownSeconds.Value) { _hud.SetCountdown(string.Empty); } else if (num > 0.0) { _hud.SetCountdown(Mathf.CeilToInt((float)num).ToString()); } else { _hud.SetCountdown(string.Empty); } } else if (_phase == GridPhase.Racing) { _hud.SetCountdown(string.Empty); } _hud.SetSpeed(_localEliminated ? 0f : _speed); } private static void SelfDestructLocalPlayer(PlayerAvatar avatar) { if (!((Object)(object)avatar == (Object)null) && !((Object)(object)avatar.playerHealth == (Object)null) && !GridAccess.GetDeadSet(avatar)) { avatar.playerHealth.Hurt(1000, false, -1, false); } } private void SpawnExplosion(Vector3 position, Color color) { //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_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0047: 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_00ad: 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_010c: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) Vector3 position2 = position + Vector3.up * 0.9f; GridAudio.PlayExplosion(position2); Material sharedMaterial = GridMaterials.CreateTrailMaterial(color); GameObject val = new GameObject("Empress Grid Flash"); val.transform.position = position2; Light val2 = val.AddComponent(); val2.type = (LightType)2; val2.color = color; val2.intensity = 28f; val2.range = 30f; ((MonoBehaviour)this).StartCoroutine(FlashRoutine(val2)); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val3).name = "Empress Grid Shockwave"; Collider component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val3.transform.position = position2; val3.transform.localScale = Vector3.one * 1.2f; MeshRenderer component2 = val3.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Renderer)component2).sharedMaterial = sharedMaterial; } ((MonoBehaviour)this).StartCoroutine(ShockwaveRoutine(val3.transform)); for (int i = 0; i < 24; i++) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "Empress Grid Shard"; obj.transform.position = position2; obj.transform.localScale = Vector3.one * Random.Range(0.25f, 0.7f); obj.transform.rotation = Random.rotation; MeshRenderer component3 = obj.GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Renderer)component3).sharedMaterial = sharedMaterial; } Collider component4 = obj.GetComponent(); if ((Object)(object)component4 != (Object)null) { component4.enabled = false; } Rigidbody obj2 = obj.AddComponent(); obj2.useGravity = true; Vector3 val4 = Random.onUnitSphere + Vector3.up; Vector3 normalized = ((Vector3)(ref val4)).normalized; obj2.velocity = normalized * Random.Range(6f, 13f); obj2.angularVelocity = Random.insideUnitSphere * 12f; Object.Destroy((Object)(object)obj, 1.6f); } } private static IEnumerator FlashRoutine(Light flash) { float t = 0f; while (t < 0.4f && (Object)(object)flash != (Object)null) { t += Time.deltaTime; flash.intensity = Mathf.Lerp(22f, 0f, t / 0.4f); yield return null; } if ((Object)(object)flash != (Object)null) { Object.Destroy((Object)(object)((Component)flash).gameObject); } } private static IEnumerator ShockwaveRoutine(Transform ring) { float t = 0f; while (t < 0.55f && (Object)(object)ring != (Object)null) { t += Time.deltaTime; float num = Mathf.Lerp(1.2f, 9f, t / 0.55f); ring.localScale = Vector3.one * num; yield return null; } if ((Object)(object)ring != (Object)null) { Object.Destroy((Object)(object)((Component)ring).gameObject); } } private void EnsureCycles() { if ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null || (Object)(object)_trailRoot == (Object)null) { return; } List list = new List(GameDirector.instance.PlayerList); list.Sort((PlayerAvatar a, PlayerAvatar b) => ViewIdOf(a).CompareTo(ViewIdOf(b))); PlayerAvatar val = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerController.instance.playerAvatarScript : null); float value = EmpressTheGridPlugin.Settings.TrailLifetime.Value; for (int i = 0; i < list.Count; i++) { PlayerAvatar val2 = list[i]; int num = ViewIdOf(val2); if (num >= 0 && !_cyclesByViewId.ContainsKey(num)) { bool isLocal = (Object)(object)val2 == (Object)(object)val; GridCycle gridCycle = GridCycle.Create(val2, num, i, isLocal, _trailRoot, value); gridCycle.SetRecording(_phase == GridPhase.Racing); _cycles.Add(gridCycle); _cyclesByViewId[num] = gridCycle; } } } private static int ViewIdOf(PlayerAvatar avatar) { if ((Object)(object)avatar == (Object)null || (Object)(object)avatar.photonView == (Object)null) { return -1; } return avatar.photonView.ViewID; } private void ClearCycles() { for (int i = 0; i < _cycles.Count; i++) { _cycles[i].Dispose(); } _cycles.Clear(); _cyclesByViewId.Clear(); } private static double Now() { if (SemiFunc.IsMultiplayer()) { return PhotonNetwork.Time; } return Time.timeAsDouble; } } internal sealed class GridTrail : MonoBehaviour { private struct TrailPoint { public Vector3 Position; public float Time; } private const float WallHeight = 1.9f; private const float HalfWidth = 0.12f; private const float MinSpacing = 0.55f; private readonly List _points = new List(); private MeshFilter _meshFilter; private Mesh _mesh; private float _lifetime = 5f; private bool _recording; private readonly List _vertices = new List(); private readonly List _bodyTriangles = new List(); private readonly List _capTriangles = new List(); public static GridTrail Create(Transform parent, Material bodyMaterial, Material capMaterial, float lifetime) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_003c: Expected O, but got Unknown GameObject val = new GameObject("Grid Trail"); val.transform.SetParent(parent, false); GridTrail gridTrail = val.AddComponent(); gridTrail._lifetime = lifetime; gridTrail._mesh = new Mesh { name = "Empress Grid Trail" }; gridTrail._meshFilter = val.AddComponent(); gridTrail._meshFilter.mesh = gridTrail._mesh; MeshRenderer val2 = val.AddComponent(); ((Renderer)val2).sharedMaterials = (Material[])(object)new Material[2] { bodyMaterial, capMaterial }; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; return gridTrail; } public void SetRecording(bool recording) { _recording = recording; } public void ClearTrail() { _points.Clear(); if ((Object)(object)_mesh != (Object)null) { _mesh.Clear(); } } public void Sample(Vector3 position) { //IL_0055: 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_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) float time = Time.time; if (_recording && (_points.Count == 0 || Vector3.Distance(_points[_points.Count - 1].Position, position) >= 0.55f)) { _points.Add(new TrailPoint { Position = position, Time = time }); } float num = time - _lifetime; int i; for (i = 0; i < _points.Count && _points[i].Time < num; i++) { } if (i > 0) { _points.RemoveRange(0, i); } RebuildMesh(); } public bool Intersects(Vector3 position, float radius, int skipNewestCount) { //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_0033: Unknown result type (might be due to invalid IL or missing references) float num = radius * radius; int num2 = _points.Count - Mathf.Max(0, skipNewestCount); for (int i = 0; i < num2; i++) { Vector3 val = _points[i].Position - position; val.y *= 0.6f; if (((Vector3)(ref val)).sqrMagnitude <= num) { return true; } } return false; } private void RebuildMesh() { //IL_005f: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_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_0108: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mesh == (Object)null) { return; } _vertices.Clear(); _bodyTriangles.Clear(); _capTriangles.Clear(); int count = _points.Count; if (count < 2) { _mesh.Clear(); return; } for (int i = 0; i < count; i++) { Vector3 position = _points[i].Position; Vector3 val = SegmentDirection(i, count); Vector3 val2 = Vector3.Cross(Vector3.up, val); if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.right; } else { ((Vector3)(ref val2)).Normalize(); } Vector3 val3 = val2 * 0.12f; Vector3 val4 = Vector3.up * 1.9f; _vertices.Add(position + val3); _vertices.Add(position + val3 + val4); _vertices.Add(position - val3); _vertices.Add(position - val3 + val4); } for (int j = 0; j < count - 1; j++) { int num = j * 4; int num2 = (j + 1) * 4; AddQuad(_bodyTriangles, num, num + 1, num2, num2 + 1); AddQuad(_bodyTriangles, num2 + 2, num2 + 3, num + 2, num + 3); AddQuad(_capTriangles, num + 1, num + 3, num2 + 1, num2 + 3); } _mesh.Clear(); _mesh.subMeshCount = 2; _mesh.SetVertices(_vertices); _mesh.SetTriangles(_bodyTriangles, 0); _mesh.SetTriangles(_capTriangles, 1); _mesh.RecalculateBounds(); } private Vector3 SegmentDirection(int index, int count) { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0056: Unknown result type (might be due to invalid IL or missing references) Vector3 position = _points[Mathf.Max(0, index - 1)].Position; Vector3 val = _points[Mathf.Min(count - 1, index + 1)].Position - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } private static void AddQuad(List triangles, int bottomA, int topA, int bottomB, int topB) { triangles.Add(bottomA); triangles.Add(topA); triangles.Add(bottomB); triangles.Add(topA); triangles.Add(topB); triangles.Add(bottomB); triangles.Add(bottomB); triangles.Add(topA); triangles.Add(bottomA); triangles.Add(bottomB); triangles.Add(topB); triangles.Add(topA); } private void OnDestroy() { if ((Object)(object)_mesh != (Object)null) { Object.Destroy((Object)(object)_mesh); } } } internal static class GridVisuals { private static bool _saved; private static int _savedAntiAliasing; private static int _savedPixelLightCount; private static Component _savedAaLayer; private static object _savedAaMode; public static void Apply(Transform root) { if (!_saved) { _savedAntiAliasing = QualitySettings.antiAliasing; _savedPixelLightCount = QualitySettings.pixelLightCount; _saved = true; } if (QualitySettings.pixelLightCount < 8) { QualitySettings.pixelLightCount = 8; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { main.allowHDR = true; if (!TryEnableSmaa(main)) { QualitySettings.antiAliasing = 8; main.allowMSAA = true; } } else { QualitySettings.antiAliasing = 8; } CreateReflectionProbe(root); } public static void Restore() { if (!_saved) { return; } QualitySettings.antiAliasing = _savedAntiAliasing; QualitySettings.pixelLightCount = _savedPixelLightCount; if ((Object)(object)_savedAaLayer != (Object)null && _savedAaMode != null) { FieldInfo fieldInfo = AccessTools.Field(((object)_savedAaLayer).GetType(), "antialiasingMode"); if (fieldInfo != null) { fieldInfo.SetValue(_savedAaLayer, _savedAaMode); } } _savedAaLayer = null; _savedAaMode = null; _saved = false; } private static bool TryEnableSmaa(Camera camera) { Type type = AccessTools.TypeByName("UnityEngine.Rendering.PostProcessing.PostProcessLayer"); if (type == null) { return false; } Component component = ((Component)camera).GetComponent(type); if ((Object)(object)component == (Object)null) { return false; } FieldInfo fieldInfo = AccessTools.Field(type, "antialiasingMode"); if (fieldInfo == null || !fieldInfo.FieldType.IsEnum) { return false; } if ((Object)(object)_savedAaLayer == (Object)null) { _savedAaLayer = component; _savedAaMode = fieldInfo.GetValue(component); } fieldInfo.SetValue(component, Enum.Parse(fieldInfo.FieldType, "SubpixelMorphologicalAntialiasing")); FieldInfo fieldInfo2 = AccessTools.Field(type, "subpixelMorphologicalAntialiasing"); if (fieldInfo2 != null) { object value = fieldInfo2.GetValue(component); if (value != null) { FieldInfo fieldInfo3 = AccessTools.Field(value.GetType(), "quality"); if (fieldInfo3 != null && fieldInfo3.FieldType.IsEnum) { fieldInfo3.SetValue(value, Enum.Parse(fieldInfo3.FieldType, "High")); } } } return true; } private static void CreateReflectionProbe(Transform root) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00ca: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)root == (Object)null)) { GameObject val = new GameObject("Empress Grid Reflection"); val.transform.SetParent(root, false); val.transform.localPosition = new Vector3(0f, 6f, 0f); ReflectionProbe obj = val.AddComponent(); obj.mode = (ReflectionProbeMode)1; obj.refreshMode = (ReflectionProbeRefreshMode)1; obj.timeSlicingMode = (ReflectionProbeTimeSlicingMode)1; obj.resolution = 128; obj.hdr = true; obj.clearFlags = (ReflectionProbeClearFlags)2; obj.backgroundColor = new Color(0.01f, 0.02f, 0.05f, 1f); obj.cullingMask = -1; obj.boxProjection = true; obj.size = new Vector3(200f, 100f, 200f); obj.center = new Vector3(0f, 14f, 0f); obj.nearClipPlane = 0.3f; obj.farClipPlane = 320f; obj.intensity = 1.1f; } } } }