Decompiled source of GangBeastsChaosMod v3.3.2
Mod/GangBeastsChaos.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using GangBeastsChaos; using Il2Cpp; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(ChaosMod), "Gang Beasts Chaos Mod", "3.3.2", "Mr Dude", null)] [assembly: MelonGame("Boneloaf", "Gang Beasts")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("GangBeastsChaos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+553fedae83af96cf2662977cff16d1c98d810234")] [assembly: AssemblyProduct("GangBeastsChaos")] [assembly: AssemblyTitle("GangBeastsChaos")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 GangBeastsChaos { public class ChaosMod : MelonMod { [Flags] private enum Need { None = 0, Bodies = 1, Lights = 2, Sources = 4, Colliders = 8, Tints = 0x10, Beasts = 0x20 } private class ChaosEffect { public string Category; public string Name; public string Group; public float DurMul = 1f; public Need Needs; public Action OnStart; public Action OnTick; public Action OnLate; public Action OnStop; } private class ActiveEffect { public ChaosEffect Effect; public float EndsAt; public float Duration; public bool Verified; public int Ticks; } private class Cache { public Action Scan; public float LastAt = -999f; public float Min = 1.5f; public float Interval = 1.5f; public float LastMs; public bool HasData; } private class ColliderSwap { public Collider C; public PhysicMaterial Orig; } private class Tint { public Renderer R; public string Prop; } private class Flame { public Transform Follow; public Rigidbody Body; public GameObject Obj; public Light Lamp; } private class Solid { public Rigidbody Rb; public Collider Col; public float Mass; public float Reach; } private float _interval = 25f; private float _duration = 45f; private float _firstDelay = 2f; private int _maxActive = 4; private bool _startOn; private const string Version = "3.3.2"; private bool _showHud = true; private bool _pauseInMenus = true; private bool _playerOnly = true; private bool _grabProps = true; private string _hudCorner = "BottomRight"; private float _hudScale = 1f; private string[] _menuWords = new string[7] { "menu", "lobby", "boot", "load", "splash", "select", "customi" }; private KeyCode _kToggle = (KeyCode)287; private KeyCode _kNow = (KeyCode)284; private KeyCode _kClear = (KeyCode)290; private KeyCode _kHud = (KeyCode)285; private KeyCode _kMenu = (KeyCode)286; private readonly HashSet<string> _disabled = new HashSet<string>(); private bool _enabled; private bool _hudOn = true; private float _nextEffectAt; private float _span = 25f; private string _sceneName = ""; private bool _sceneIsMenu = true; private float _offHintUntil; private ChaosEffect _next; private readonly List<string> _recent = new List<string>(); private readonly List<ChaosEffect> _all = new List<ChaosEffect>(); private readonly List<ActiveEffect> _active = new List<ActiveEffect>(); private readonly HashSet<string> _errLogged = new HashSet<string>(); private readonly Random _rng = new Random(); private float _fps = 60f; private float _worstWin; private float _worst; private float _worstAt; private float _modMs; private float _lastStartMs; private float _lastStartAt = -999f; private int _hit; private GUIStyle _style; private GUIStyle _big; private GUIStyle _mid; private string _toast = ""; private float _toastAt = -999f; private Color _toastColor = Color.white; private string _status = ""; private float _statusAt = -999f; private float _statusLen = 2.5f; private Color _statusColor = Color.white; private bool _menuOpen; private int _menuCat; private int _menuSel; private bool _curSaved; private bool _curVisible; private CursorLockMode _curLock; private List<string> _cats; private Vector2 _menuPos; private bool _menuPosSet; private bool _dragging; private Vector2 _dragOff; private readonly List<Transform> _beastRoots = new List<Transform>(); private readonly List<Rigidbody> _beastBodies = new List<Rigidbody>(); private int _dynCount; private List<Transform> _playerRoots = new List<Transform>(); private float _playerAt = -999f; private int _playerFallbackId; private Cache _cBodies; private Cache _cLights; private Cache _cSources; private Cache _cColliders; private Cache _cTints; private Rigidbody[] _bodies = (Rigidbody[])(object)new Rigidbody[0]; private Light[] _lights = (Light[])(object)new Light[0]; private AudioSource[] _sources = (AudioSource[])(object)new AudioSource[0]; private Collider[] _colliders = (Collider[])(object)new Collider[0]; private bool _legacyOk = true; private readonly HashSet<KeyCode> _held = new HashSet<KeyCode>(); private readonly HashSet<KeyCode> _pending = new HashSet<KeyCode>(); private GUIStyle _barStyle; private bool _textBars; private bool _gravTouched; private Vector3 _gravBase; private bool _timeTouched; private float _timeBase = 1f; private Vector3 _rollG; private float _timeWant = 1f; private readonly List<Rigidbody> _pBodies = new List<Rigidbody>(); private readonly List<float> _pMass = new List<float>(); private readonly List<float> _pDrag = new List<float>(); private readonly List<float> _pAngDrag = new List<float>(); private readonly List<Transform> _roots = new List<Transform>(); private readonly List<Vector3> _rootScale = new List<Vector3>(); private readonly List<ColliderSwap> _swaps = new List<ColliderSwap>(); private PhysicMaterial _chaosMat; private PhysicMaterial _ballMat; private float _fovBase = 60f; private bool _fovHeld; private Camera _cam; private float _wantFov; private float _wantRoll; private readonly List<Camera> _camHeld = new List<Camera>(); private bool _camLogged; private readonly List<Light> _lsRef = new List<Light>(); private readonly List<Color> _lsColor = new List<Color>(); private readonly List<float> _lsIntensity = new List<float>(); private bool _fogHeld; private bool _fogWasOn; private Color _fogWasColor; private float _fogWasDensity; private FogMode _fogWasMode; private readonly List<Tint> _tints = new List<Tint>(); private MaterialPropertyBlock _block; private readonly List<AudioSource> _asRef = new List<AudioSource>(); private readonly List<float> _asPitch = new List<float>(); private float _volBase = 1f; private bool _volHeld; private readonly List<GameObject> _spawned = new List<GameObject>(); private MaterialPropertyBlock _propBlock; private Material _propMat; private bool _propMatTried; private readonly List<Flame> _flames = new List<Flame>(); private readonly List<Rigidbody> _bots = new List<Rigidbody>(); private List<Transform> _botTargets = new List<Transform>(); private readonly List<Vector3> _botPos = new List<Vector3>(); private readonly List<Solid> _solids = new List<Solid>(); private readonly List<Vector3> _solidPos = new List<Vector3>(); private readonly List<Vector3> _bodyPos = new List<Vector3>(); private bool Live { get { if (!_enabled && !_menuOpen) { return _active.Count > 0; } return true; } } private bool CamWanted { get { if (!(_wantFov > 0f) && !(Mathf.Abs(_wantRoll) > 0.01f)) { return _camHeld.Count > 0; } return true; } } public override void OnInitializeMelon() { LoadConfig(); SetupCaches(); BuildEffects(); if (_disabled.Count > 0) { _all.RemoveAll((ChaosEffect e) => _disabled.Contains(e.Name)); } _enabled = _startOn; _hudOn = _showHud; ScheduleNext(_firstDelay); _next = PickNext(); _offHintUntil = Time.unscaledTime + 30f; ((MelonBase)this).LoggerInstance.Msg("Chaos Mod 3.3.2 loaded with " + _all.Count + " effects. " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kToggle)/*cast due to .constrained prefix*/).ToString() + " = chaos on/off, " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kNow)/*cast due to .constrained prefix*/).ToString() + " = chaos now, " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kClear)/*cast due to .constrained prefix*/).ToString() + " = clear, " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kHud)/*cast due to .constrained prefix*/).ToString() + " = bars, " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kMenu)/*cast due to .constrained prefix*/).ToString() + " = manual menu."); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { _sceneName = sceneName ?? ""; _sceneIsMenu = LooksLikeMenu(_sceneName); ((MelonBase)this).LoggerInstance.Msg("Scene '" + _sceneName + "' -> " + (_sceneIsMenu ? "MENU (chaos paused)" : "MATCH (chaos can run)")); _fovHeld = false; _fogHeld = false; ClearAll(); InvalidateCaches(); ScheduleNext(_firstDelay); _next = PickNext(); } private bool LooksLikeMenu(string scene) { if (string.IsNullOrEmpty(scene)) { return true; } string text = scene.ToLowerInvariant(); for (int i = 0; i < _menuWords.Length; i++) { if (_menuWords[i].Length > 0 && text.Contains(_menuWords[i])) { return true; } } return false; } public override void OnUpdate() { Stopwatch stopwatch = Stopwatch.StartNew(); try { UpdateInner(); } catch (Exception ex) { if (_errLogged.Add("update")) { ((MelonBase)this).LoggerInstance.Error("Chaos update failed: " + ex); } } stopwatch.Stop(); TrackFrame((float)stopwatch.Elapsed.TotalMilliseconds); } private void TrackFrame(float modMs) { float unscaledDeltaTime = Time.unscaledDeltaTime; float unscaledTime = Time.unscaledTime; if (unscaledDeltaTime > 0.0001f) { _fps = Mathf.Lerp(_fps, 1f / unscaledDeltaTime, 0.05f); } _modMs = Mathf.Lerp(_modMs, modMs, 0.1f); float num = unscaledDeltaTime * 1000f; if (num > _worstWin) { _worstWin = num; } if (unscaledTime - _worstAt > 5f) { _worst = _worstWin; _worstWin = 0f; _worstAt = unscaledTime; } if (num > 400f && unscaledTime - _lastStartAt < 2f) { ((MelonBase)this).LoggerInstance.Warning("Frame hitch of " + (int)num + " ms right after an effect started (mod part of this frame: " + (int)modMs + " ms)."); } } private void SetEnabled(bool on) { //IL_002a: 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_006e: Unknown result type (might be due to invalid IL or missing references) _enabled = on; if (!on) { ClearAll(); Status("CHAOS MOD OFF", new Color(1f, 0.3f, 0.25f, 1f), 2.5f); _offHintUntil = Time.unscaledTime + 3f; } else if (IsPaused()) { Status("CHAOS MOD ON v3.3.2 (starts when a match begins)", new Color(0.35f, 1f, 0.4f, 1f), 3.5f); ScheduleNext(_firstDelay); } else { Status("CHAOS MOD ON v3.3.2", new Color(0.35f, 1f, 0.4f, 1f), 2.5f); TriggerNow(); ScheduleNext(_interval); } ((MelonBase)this).LoggerInstance.Msg("Chaos mod " + (on ? "ON" : "OFF") + " (scene '" + _sceneName + "', " + (IsPaused() ? "menu" : "match") + ")"); } private void Status(string text, Color col, float seconds) { //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) _status = text; _statusAt = Time.unscaledTime; _statusLen = seconds; _statusColor = col; } private void UpdateInner() { //IL_0008: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; bool num = Pressed(_kToggle); bool flag = Pressed(_kNow); bool flag2 = Pressed(_kClear); if (Pressed(_kHud)) { _hudOn = !_hudOn; } if (num) { SetEnabled(!_enabled); } if (Pressed(_kMenu)) { SetMenu(!_menuOpen); } if (_menuOpen) { MenuKeys(); } if (!Live) { return; } bool flag3 = IsPaused(); if (flag2) { ClearAll(); Status("ALL EFFECTS CLEARED", Color.white, 1.5f); } if (flag && !_enabled && !_menuOpen) { Status("Press " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kToggle)/*cast due to .constrained prefix*/).ToString() + " for auto chaos or " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kMenu)/*cast due to .constrained prefix*/).ToString() + " for the menu", Color.white, 2f); } else if (flag) { if (flag3) { Status("Chaos waits for a match", Color.white, 2f); } else { TriggerNow(); } } if (flag3) { _nextEffectAt += Time.unscaledDeltaTime; } else if (_enabled && unscaledTime >= _nextEffectAt) { TriggerNow(); ScheduleNext(_interval); } for (int num2 = _active.Count - 1; num2 >= 0; num2--) { ActiveEffect activeEffect = _active[num2]; if (unscaledTime >= activeEffect.EndsAt) { SafeCall(activeEffect.Effect.OnStop); _active.RemoveAt(num2); } else if (activeEffect.Effect.OnTick != null) { RunChecked(activeEffect, activeEffect.Effect.OnTick); } } TimeHold(); if (CamWanted) { CamApply(); } try { SolidsTick(); } catch (Exception ex) { if (_errLogged.Add("solids")) { ((MelonBase)this).LoggerInstance.Warning("Prop contact check failed: " + ex.Message); } } try { if (!flag3) { PhysicsGuard(); } } catch (Exception ex2) { if (_errLogged.Add("guard-fail")) { ((MelonBase)this).LoggerInstance.Warning("Physics guard failed: " + ex2.Message); } } if (!flag3) { PumpCaches(unscaledTime); } } public override void OnFixedUpdate() { TimeHold(); } public override void OnLateUpdate() { if (!Live) { return; } for (int i = 0; i < _active.Count; i++) { ChaosEffect effect = _active[i].Effect; if (effect.OnLate != null) { RunChecked(_active[i], effect.OnLate); } } TimeHold(); if (CamWanted) { CamApply(); } } private void LoadConfig() { //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) try { MelonPreferences_Category obj = MelonPreferences.CreateCategory("GangBeastsChaos"); obj.SetFilePath("UserData/GangBeastsChaos.cfg"); MelonPreferences_Entry<float> val = obj.CreateEntry<float>("EffectInterval", 25f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<float> val2 = obj.CreateEntry<float>("EffectDuration", 45f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<float> val3 = obj.CreateEntry<float>("FirstEffectDelaySeconds", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<int> val4 = obj.CreateEntry<int>("MaxActiveEffects", 4, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<bool> val5 = obj.CreateEntry<bool>("StartWithChaosOn", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<bool> val6 = obj.CreateEntry<bool>("ShowHud", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<bool> val7 = obj.CreateEntry<bool>("PauseInMenus", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val8 = obj.CreateEntry<string>("MenuSceneWords", "menu,lobby,boot,load,splash,select,customi", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val9 = obj.CreateEntry<string>("HudCorner", "BottomRight", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<float> val10 = obj.CreateEntry<float>("HudScale", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val11 = obj.CreateEntry<string>("KeyToggle", "F6", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val12 = obj.CreateEntry<string>("KeyChaosNow", "F3", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val13 = obj.CreateEntry<string>("KeyClearAll", "F9", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val14 = obj.CreateEntry<string>("KeyHud", "F4", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val15 = obj.CreateEntry<string>("KeyMenu", "F5", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<bool> val16 = obj.CreateEntry<bool>("PlayerOnlyEffects", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<bool> val17 = obj.CreateEntry<bool>("GrabbableProps", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<string> val18 = obj.CreateEntry<string>("DisabledEffects", "", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _interval = Mathf.Clamp(val.Value, 3f, 600f); _duration = Mathf.Clamp(val2.Value, 3f, 600f); _firstDelay = Mathf.Clamp(val3.Value, 0f, 120f); _maxActive = Mathf.Clamp(val4.Value, 1, 12); _startOn = val5.Value; _playerOnly = val16.Value; _grabProps = val17.Value; _showHud = val6.Value; _pauseInMenus = val7.Value; _hudScale = Mathf.Clamp(val10.Value, 0.5f, 2.5f); _hudCorner = (string.IsNullOrEmpty(val9.Value) ? "BottomRight" : val9.Value.Trim()); _kToggle = ParseKey(val11.Value, (KeyCode)287); _kNow = ParseKey(val12.Value, (KeyCode)284); _kClear = ParseKey(val13.Value, (KeyCode)290); _kHud = ParseKey(val14.Value, (KeyCode)285); _kMenu = ParseKey(val15.Value, (KeyCode)286); if (!string.IsNullOrEmpty(val8.Value)) { string[] array = val8.Value.Split(','); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Trim().ToLowerInvariant(); } _menuWords = array; } string value = val18.Value; if (!string.IsNullOrEmpty(value)) { string[] array2 = value.Split(','); for (int j = 0; j < array2.Length; j++) { string text = array2[j].Trim(); if (text.Length > 0) { _disabled.Add(text); } } } MelonPreferences.Save(); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Could not load config, using defaults: " + ex.Message); } } private static KeyCode ParseKey(string s, KeyCode fallback) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_001e: Unknown result type (might be due to invalid IL or missing references) try { return (KeyCode)Enum.Parse(typeof(KeyCode), s, ignoreCase: true); } catch (Exception) { return fallback; } } private void ScheduleNext(float delay) { _nextEffectAt = Time.unscaledTime + delay; _span = Mathf.Max(0.1f, delay); } private bool IsPaused() { if (_pauseInMenus) { return _sceneIsMenu; } return false; } private bool IsActive(ChaosEffect e) { for (int i = 0; i < _active.Count; i++) { if (_active[i].Effect == e) { return true; } } return false; } private bool Ready(ChaosEffect e) { if ((e.Needs & Need.Bodies) != Need.None && (!_cBodies.HasData || _dynCount == 0)) { return false; } if ((e.Category == "Beasts" || (e.Needs & (Need.Tints | Need.Beasts)) != Need.None) && _beastRoots.Count == 0) { return false; } if ((e.Needs & Need.Lights) != Need.None && (!_cLights.HasData || _lights.Length == 0)) { return false; } if ((e.Needs & Need.Sources) != Need.None && (!_cSources.HasData || _sources.Length == 0)) { return false; } if ((e.Needs & Need.Colliders) != Need.None && (!_cColliders.HasData || _colliders.Length == 0)) { return false; } if ((e.Needs & Need.Tints) != Need.None && !_cTints.HasData) { return false; } return true; } private ChaosEffect PickNext() { List<ChaosEffect> list = new List<ChaosEffect>(); for (int i = 0; i < _all.Count; i++) { ChaosEffect chaosEffect = _all[i]; if (!IsActive(chaosEffect) && !_recent.Contains(chaosEffect.Name)) { list.Add(chaosEffect); } } if (list.Count == 0) { for (int j = 0; j < _all.Count; j++) { if (!IsActive(_all[j])) { list.Add(_all[j]); } } } if (list.Count == 0) { return null; } return list[_rng.Next(list.Count)]; } private ChaosEffect PickReady() { List<ChaosEffect> list = new List<ChaosEffect>(); for (int i = 0; i < _all.Count; i++) { ChaosEffect chaosEffect = _all[i]; if (!IsActive(chaosEffect) && !_recent.Contains(chaosEffect.Name) && Ready(chaosEffect)) { list.Add(chaosEffect); } } if (list.Count == 0) { for (int j = 0; j < _all.Count; j++) { if (!IsActive(_all[j]) && Ready(_all[j])) { list.Add(_all[j]); } } } if (list.Count == 0) { return null; } return list[_rng.Next(list.Count)]; } private void TriggerNow() { ChaosEffect chaosEffect = _next; bool flag = true; if (chaosEffect == null || IsActive(chaosEffect) || !Ready(chaosEffect)) { ChaosEffect chaosEffect2 = PickReady(); if (chaosEffect2 != null) { chaosEffect = chaosEffect2; flag = false; } else if (chaosEffect == null || IsActive(chaosEffect)) { chaosEffect = PickNext(); flag = true; } } if (chaosEffect != null) { StartEffect(chaosEffect); if (flag || _next == null || IsActive(_next)) { _next = PickNext(); } } } private void StartEffect(ChaosEffect effect) { //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) _toast = effect.Name; _toastAt = Time.unscaledTime; _toastColor = CatColor(effect.Category); if (effect.Group != null) { for (int num = _active.Count - 1; num >= 0; num--) { if (_active[num].Effect.Group == effect.Group) { SafeCall(_active[num].Effect.OnStop); _active.RemoveAt(num); } } } while (_active.Count >= _maxActive && _active.Count > 0) { SafeCall(_active[0].Effect.OnStop); _active.RemoveAt(0); } _hit = 0; Stopwatch stopwatch = Stopwatch.StartNew(); SafeCall(effect.OnStart); stopwatch.Stop(); _lastStartMs = (float)stopwatch.Elapsed.TotalMilliseconds; _lastStartAt = Time.unscaledTime; float num2 = _duration * effect.DurMul; _active.Add(new ActiveEffect { Effect = effect, EndsAt = Time.unscaledTime + num2, Duration = num2, Verified = (effect.OnStart != null && _hit > 0) }); _recent.Add(effect.Name); if (_recent.Count > 8) { _recent.RemoveAt(0); } ((MelonBase)this).LoggerInstance.Msg("Chaos: " + effect.Name + " (start " + stopwatch.ElapsedMilliseconds + " ms, changed " + _hit + ")"); if (effect.OnStart != null && effect.OnTick == null && effect.OnLate == null && _hit == 0) { ((MelonBase)this).LoggerInstance.Warning("Effect '" + effect.Name + "' changed nothing (no matching objects found)."); } if (stopwatch.ElapsedMilliseconds > 100) { ((MelonBase)this).LoggerInstance.Warning("Effect '" + effect.Name + "' started slowly (" + stopwatch.ElapsedMilliseconds + " ms). Please send this log line."); } } private List<string> Cats() { if (_cats == null) { _cats = new List<string>(); for (int i = 0; i < _all.Count; i++) { if (!_cats.Contains(_all[i].Category)) { _cats.Add(_all[i].Category); } } } return _cats; } private List<ChaosEffect> CatItems(int cat) { List<ChaosEffect> list = new List<ChaosEffect>(); List<string> list2 = Cats(); if (list2.Count == 0) { return list; } string text = list2[Mathf.Clamp(cat, 0, list2.Count - 1)]; for (int i = 0; i < _all.Count; i++) { if (_all[i].Category == text) { list.Add(_all[i]); } } return list; } private void SetMenu(bool open) { //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (open == _menuOpen) { return; } _menuOpen = open; try { if (open) { _curVisible = Cursor.visible; _curLock = Cursor.lockState; _curSaved = true; _pending.Remove((KeyCode)273); _pending.Remove((KeyCode)274); _pending.Remove((KeyCode)276); _pending.Remove((KeyCode)275); _pending.Remove((KeyCode)13); _pending.Remove((KeyCode)27); _menuSel = 0; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; if (IsPaused()) { Status("Effects can only start in a match", Color.white, 3f); } } else if (_curSaved) { Cursor.lockState = _curLock; Cursor.visible = _curVisible; } } catch (Exception ex) { if (_errLogged.Add("cursor")) { ((MelonBase)this).LoggerInstance.Warning("Cursor change failed: " + ex.Message); } } } private void MenuKeys() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) try { if (!Cursor.visible || (int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } catch (Exception) { } List<string> list = Cats(); if (list.Count == 0) { return; } if (Pressed((KeyCode)27)) { SetMenu(open: false); return; } if (Pressed((KeyCode)275)) { _menuCat = (_menuCat + 1) % list.Count; _menuSel = 0; } if (Pressed((KeyCode)276)) { _menuCat = (_menuCat + list.Count - 1) % list.Count; _menuSel = 0; } List<ChaosEffect> list2 = CatItems(_menuCat); if (list2.Count != 0) { if (_menuSel >= list2.Count) { _menuSel = 0; } if (Pressed((KeyCode)274)) { _menuSel = (_menuSel + 1) % list2.Count; } if (Pressed((KeyCode)273)) { _menuSel = (_menuSel + list2.Count - 1) % list2.Count; } if (Pressed((KeyCode)13) || Pressed((KeyCode)271)) { ManualStart(list2[_menuSel]); } } } private void ManualStart(ChaosEffect e) { //IL_0045: 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_00d1: Unknown result type (might be due to invalid IL or missing references) if (e == null) { return; } for (int i = 0; i < _active.Count; i++) { if (_active[i].Effect == e) { SafeCall(e.OnStop); _active.RemoveAt(i); Status(e.Name + " stopped", Color.white, 1.5f); return; } } if (IsPaused()) { Status("Effects can only start in a match", Color.white, 2f); return; } StartEffect(e); if (e.OnStart != null && e.OnTick == null && e.OnLate == null && _hit == 0) { Status(e.Name + ": nothing to affect right now", new Color(1f, 0.7f, 0.3f, 1f), 2.5f); } } private Rect MenuPanel() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) float hudScale = _hudScale; float num = Mathf.Min((float)Screen.width - 20f, 720f * hudScale); float num2 = 328f * hudScale; if (!_menuPosSet) { _menuPos = new Vector2(((float)Screen.width - num) * 0.5f, Mathf.Max(10f, ((float)Screen.height - num2) * 0.3f)); _menuPosSet = true; } _menuPos.x = Mathf.Clamp(_menuPos.x, 0f, Mathf.Max(0f, (float)Screen.width - num)); _menuPos.y = Mathf.Clamp(_menuPos.y, 0f, Mathf.Max(0f, (float)Screen.height - num2)); return new Rect(_menuPos.x, _menuPos.y, num, num2); } private Rect MenuTitle() { //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_0028: Unknown result type (might be due to invalid IL or missing references) Rect val = MenuPanel(); return new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 38f * _hudScale); } private Rect MenuClose() { //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_0042: Unknown result type (might be due to invalid IL or missing references) Rect val = MenuPanel(); float hudScale = _hudScale; return new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - 30f * hudScale, ((Rect)(ref val)).y + 10f * hudScale, 22f * hudScale, 22f * hudScale); } private Rect MenuTab(int i, int n) { //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_004e: Unknown result type (might be due to invalid IL or missing references) Rect val = MenuPanel(); float hudScale = _hudScale; float num = (((Rect)(ref val)).width - 16f) / (float)n; return new Rect(((Rect)(ref val)).x + 8f + (float)i * num, ((Rect)(ref val)).y + 44f * hudScale, num - 3f, 28f * hudScale); } private Rect MenuItem(int j) { //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_0066: Unknown result type (might be due to invalid IL or missing references) Rect val = MenuPanel(); float hudScale = _hudScale; float num = (((Rect)(ref val)).width - 24f) * 0.5f; int num2 = j / 7; int num3 = j % 7; return new Rect(((Rect)(ref val)).x + 8f + (float)num2 * (num + 8f), ((Rect)(ref val)).y + 80f * hudScale + (float)num3 * 30f * hudScale, num, 28f * hudScale); } private Rect MenuButton(int k) { //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_0057: Unknown result type (might be due to invalid IL or missing references) Rect val = MenuPanel(); float hudScale = _hudScale; float num = (((Rect)(ref val)).width - 16f - 16f) / 3f; return new Rect(((Rect)(ref val)).x + 8f + (float)k * (num + 8f), ((Rect)(ref val)).y + 296f * hudScale, num, 26f * hudScale); } private void MenuMouse(Event ev) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_004c: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector2 mousePosition = ev.mousePosition; if ((int)ev.type == 1) { _dragging = false; } else if ((int)ev.type == 3) { if (_dragging) { _menuPos = mousePosition - _dragOff; ev.Use(); } } else if (ev.button == 0 && MenuClick(mousePosition)) { ev.Use(); } } private bool MenuClick(Vector2 m) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) List<string> list = Cats(); if (list.Count == 0) { return false; } Rect val = MenuPanel(); if (!((Rect)(ref val)).Contains(m)) { return false; } Rect val2 = MenuClose(); if (((Rect)(ref val2)).Contains(m)) { SetMenu(open: false); return true; } val2 = MenuTitle(); if (((Rect)(ref val2)).Contains(m)) { _dragging = true; _dragOff = m - new Vector2(((Rect)(ref val)).x, ((Rect)(ref val)).y); return true; } for (int i = 0; i < list.Count; i++) { val2 = MenuTab(i, list.Count); if (((Rect)(ref val2)).Contains(m)) { _menuCat = i; _menuSel = 0; return true; } } List<ChaosEffect> list2 = CatItems(_menuCat); for (int j = 0; j < list2.Count && j < 14; j++) { val2 = MenuItem(j); if (((Rect)(ref val2)).Contains(m)) { _menuSel = j; ManualStart(list2[j]); return true; } } val2 = MenuButton(0); if (((Rect)(ref val2)).Contains(m)) { ManualRandom(); return true; } val2 = MenuButton(1); if (((Rect)(ref val2)).Contains(m)) { ClearAll(); Status("ALL EFFECTS CLEARED", Color.white, 1.5f); return true; } val2 = MenuButton(2); if (((Rect)(ref val2)).Contains(m)) { SetEnabled(!_enabled); return true; } return true; } private void ManualRandom() { //IL_000e: 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) if (IsPaused()) { Status("Effects can only start in a match", Color.white, 2f); return; } ChaosEffect chaosEffect = PickReady(); if (chaosEffect == null) { Status("Nothing is ready yet, try again in a second", Color.white, 2f); } else { StartEffect(chaosEffect); } } private ActiveEffect FindActive(ChaosEffect e) { for (int i = 0; i < _active.Count; i++) { if (_active[i].Effect == e) { return _active[i]; } } return null; } private void DrawButton(Rect r, string text, Vector2 mouse, Color col) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005e: 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_0091: 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) bool flag = ((Rect)(ref r)).Contains(mouse); DrawBox(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, ((Rect)(ref r)).height, flag ? new Color(col.r, col.g, col.b, 1f) : new Color(0.2f, 0.2f, 0.22f, 1f)); DrawBox(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).height - 3f, ((Rect)(ref r)).width, 3f, col); DrawText(((Rect)(ref r)).x + 10f, ((Rect)(ref r)).y + 4f * _hudScale, ((Rect)(ref r)).width, ((Rect)(ref r)).height, text, _style, Color.white); } private void DrawMenu() { //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_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_0044: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) List<string> list = Cats(); if (list.Count == 0) { return; } float hudScale = _hudScale; Rect val = MenuPanel(); Vector2 mousePosition = Event.current.mousePosition; float unscaledTime = Time.unscaledTime; new Color(1f, 0.82f, 0.1f, 1f); new Color(0.08f, 0.08f, 0.09f, 1f); DrawBox(((Rect)(ref val)).x + 6f, ((Rect)(ref val)).y + 6f, ((Rect)(ref val)).width, ((Rect)(ref val)).height, new Color(0f, 0f, 0f, 0.55f)); DrawBox(((Rect)(ref val)).x - 2f, ((Rect)(ref val)).y - 2f, ((Rect)(ref val)).width + 4f, ((Rect)(ref val)).height + 4f, Color.black); DrawBox(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height, Color.black); float num = 14f * hudScale; int num2 = Mathf.CeilToInt(((Rect)(ref val)).width / num); for (int i = 0; i < num2; i++) { DrawBox(((Rect)(ref val)).x + (float)i * num, ((Rect)(ref val)).y, Mathf.Min(num, ((Rect)(ref val)).width - (float)i * num), 6f * hudScale, Color.black); } DrawText(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 9f * hudScale, 260f, 30f * hudScale, "CHAOS MENU", _mid, Color.white); DrawText(((Rect)(ref val)).x + 175f * hudScale, ((Rect)(ref val)).y + 14f * hudScale, 300f, 24f * hudScale, _enabled ? "auto chaos is ON" : "manual - nothing starts by itself", _style, new Color(1f, 1f, 1f, 0.55f)); Rect val2 = MenuClose(); bool flag = ((Rect)(ref val2)).Contains(mousePosition); DrawBox(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height, flag ? new Color(0.9f, 0.2f, 0.18f, 1f) : new Color(0.25f, 0.25f, 0.28f, 1f)); DrawText(((Rect)(ref val2)).x + 6f * hudScale, ((Rect)(ref val2)).y + 2f * hudScale, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height, "X", _style, Color.white); for (int j = 0; j < list.Count; j++) { Rect val3 = MenuTab(j, list.Count); Color val4 = CatColor(list[j]); bool flag2 = j == _menuCat; DrawBox(((Rect)(ref val3)).x, ((Rect)(ref val3)).y, ((Rect)(ref val3)).width, ((Rect)(ref val3)).height, flag2 ? new Color(val4.r, val4.g, val4.b, 1f) : (((Rect)(ref val3)).Contains(mousePosition) ? new Color(0.28f, 0.28f, 0.31f, 1f) : new Color(0.18f, 0.18f, 0.2f, 1f))); if (!flag2) { DrawBox(((Rect)(ref val3)).x, ((Rect)(ref val3)).y + ((Rect)(ref val3)).height - 3f, ((Rect)(ref val3)).width, 3f, val4); } DrawText(((Rect)(ref val3)).x + 6f, ((Rect)(ref val3)).y + 4f * hudScale, ((Rect)(ref val3)).width, ((Rect)(ref val3)).height, list[j], _style, Color.white); } List<ChaosEffect> list2 = CatItems(_menuCat); if (_menuSel >= list2.Count) { _menuSel = 0; } for (int k = 0; k < list2.Count && k < 14; k++) { Rect val5 = MenuItem(k); ChaosEffect chaosEffect = list2[k]; Color val6 = CatColor(chaosEffect.Category); ActiveEffect activeEffect = FindActive(chaosEffect); bool flag3 = ((Rect)(ref val5)).Contains(mousePosition); Color col = ((activeEffect != null) ? new Color(val6.r * 0.55f, val6.g * 0.55f, val6.b * 0.55f, 1f) : (flag3 ? new Color(0.3f, 0.3f, 0.33f, 1f) : new Color(0.17f, 0.17f, 0.19f, 1f))); DrawBox(((Rect)(ref val5)).x, ((Rect)(ref val5)).y, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height, col); DrawBox(((Rect)(ref val5)).x, ((Rect)(ref val5)).y, ((k == _menuSel) ? 8f : 4f) * hudScale, ((Rect)(ref val5)).height, val6); string text = chaosEffect.Name; if (activeEffect == null && !Ready(chaosEffect)) { text += " (loading)"; } DrawText(((Rect)(ref val5)).x + 14f * hudScale, ((Rect)(ref val5)).y + 5f * hudScale, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height, text, _style, Color.white); if (activeEffect != null) { float num3 = Mathf.Max(0f, activeEffect.EndsAt - unscaledTime); DrawBox(((Rect)(ref val5)).x, ((Rect)(ref val5)).y + ((Rect)(ref val5)).height - 3f, ((Rect)(ref val5)).width * Mathf.Clamp01(num3 / Mathf.Max(0.1f, activeEffect.Duration)), 3f, Color.white); DrawText(((Rect)(ref val5)).x + ((Rect)(ref val5)).width - 44f * hudScale, ((Rect)(ref val5)).y + 5f * hudScale, 60f, ((Rect)(ref val5)).height, Mathf.CeilToInt(num3) + "s", _style, Color.white); } } DrawButton(MenuButton(0), "RANDOM ONE", mousePosition, new Color(0.35f, 0.65f, 1f, 1f)); DrawButton(MenuButton(1), "CLEAR ALL", mousePosition, new Color(1f, 0.4f, 0.3f, 1f)); DrawButton(MenuButton(2), _enabled ? "AUTO: ON" : "AUTO: OFF", mousePosition, _enabled ? new Color(0.4f, 0.9f, 0.45f, 1f) : new Color(0.6f, 0.6f, 0.65f, 1f)); } private void ClearAll() { for (int i = 0; i < _active.Count; i++) { SafeCall(_active[i].Effect.OnStop); } _active.Clear(); DestroySpawned(); RestoreGravity(); RestoreTime(); _wantFov = 0f; _wantRoll = 0f; CamApply(); } private void RunChecked(ActiveEffect a, Action act) { if (a.Verified) { TickSafe(act, a.Effect.Name); return; } _hit = 0; TickSafe(act, a.Effect.Name); if (_hit > 0) { a.Verified = true; } else if (++a.Ticks >= 300) { a.Verified = true; ((MelonBase)this).LoggerInstance.Warning("Effect '" + a.Effect.Name + "' is running but changes nothing."); } } private void SafeCall(Action a) { if (a == null) { return; } try { a(); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error(ex.ToString()); } } private void TickSafe(Action a, string name) { try { a(); } catch (Exception ex) { if (_errLogged.Add(name)) { ((MelonBase)this).LoggerInstance.Error("Effect '" + name + "' tick failed: " + ex.Message); } } } private void RebuildBeasts() { _beastRoots.Clear(); _beastBodies.Clear(); _dynCount = 0; Dictionary<int, int> dictionary = new Dictionary<int, int>(); Dictionary<int, Transform> dictionary2 = new Dictionary<int, Transform>(); int[] array = new int[_bodies.Length]; for (int i = 0; i < _bodies.Length; i++) { Rigidbody val = _bodies[i]; if (!((Object)(object)val == (Object)null) && !val.isKinematic) { _dynCount++; Transform root = ((Component)val).transform.root; if (!((Object)(object)root == (Object)null)) { int key = (array[i] = ((Object)root).GetInstanceID()); dictionary.TryGetValue(key, out var value); dictionary[key] = value + 1; dictionary2[key] = root; } } } HashSet<int> hashSet = new HashSet<int>(); foreach (KeyValuePair<int, int> item in dictionary) { if (item.Value >= 6 && dictionary2[item.Key].childCount <= 60) { hashSet.Add(item.Key); _beastRoots.Add(dictionary2[item.Key]); } } for (int j = 0; j < _bodies.Length; j++) { if (array[j] != 0 && hashSet.Contains(array[j])) { _beastBodies.Add(_bodies[j]); } } } private List<Transform> TargetRoots() { Bodies(); List<Transform> list = new List<Transform>(_beastRoots); list.RemoveAll((Transform r) => (Object)(object)r == (Object)null); if (!_playerOnly || list.Count <= 1) { return list; } float unscaledTime = Time.unscaledTime; if (unscaledTime - _playerAt < 4f && _playerRoots.Count > 0) { bool flag = true; for (int num = 0; num < _playerRoots.Count; num++) { if ((Object)(object)_playerRoots[num] == (Object)null) { flag = false; } } if (flag) { return _playerRoots; } } _playerAt = unscaledTime; List<Transform> list2 = new List<Transform>(); Transform val = null; for (int num2 = 0; num2 < list.Count; num2++) { if (((Object)list[num2]).GetInstanceID() == _playerFallbackId) { val = list[num2]; } } if ((Object)(object)val == (Object)null) { val = list[0]; _playerFallbackId = ((Object)val).GetInstanceID(); } list2.Add(val); _playerRoots = list2; return list2; } private void SetupCaches() { _cBodies = new Cache { Min = 3f, Interval = 3f, Scan = delegate { _bodies = Il2CppArrayBase<Rigidbody>.op_Implicit(Object.FindObjectsOfType<Rigidbody>()); RebuildBeasts(); } }; _cLights = new Cache { Scan = delegate { _lights = Il2CppArrayBase<Light>.op_Implicit(Object.FindObjectsOfType<Light>()); } }; _cSources = new Cache { Scan = delegate { _sources = Il2CppArrayBase<AudioSource>.op_Implicit(Object.FindObjectsOfType<AudioSource>()); } }; _cColliders = new Cache { Scan = delegate { _colliders = Il2CppArrayBase<Collider>.op_Implicit(Object.FindObjectsOfType<Collider>()); } }; _cTints = new Cache { Scan = ScanTints }; } private void InvalidateCaches() { Cache[] array = new Cache[5] { _cBodies, _cLights, _cSources, _cColliders, _cTints }; for (int i = 0; i < array.Length; i++) { array[i].HasData = false; array[i].LastAt = -999f; } _bodies = (Rigidbody[])(object)new Rigidbody[0]; _beastRoots.Clear(); _beastBodies.Clear(); _dynCount = 0; _propMat = null; _propMatTried = false; _playerRoots = new List<Transform>(); _playerAt = -999f; _playerFallbackId = 0; _lights = (Light[])(object)new Light[0]; _sources = (AudioSource[])(object)new AudioSource[0]; _colliders = (Collider[])(object)new Collider[0]; _tints.Clear(); } private void RunScan(Cache c) { Stopwatch stopwatch = Stopwatch.StartNew(); try { c.Scan(); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Scene scan failed: " + ex.Message); } stopwatch.Stop(); c.LastMs = (float)stopwatch.Elapsed.TotalMilliseconds; c.LastAt = Time.unscaledTime; c.HasData = true; c.Interval = Mathf.Clamp(c.LastMs / 40f, c.Min, 30f); } private bool Stale(Cache c, float minAge) { if (!c.HasData) { return true; } return Time.unscaledTime - c.LastAt > Mathf.Max(minAge, c.Interval * 1.5f); } private void PumpCaches(float now) { Need need = Need.Bodies; for (int i = 0; i < _active.Count; i++) { need |= _active[i].Effect.Needs & (Need.Bodies | Need.Tints); } if (_next != null && _nextEffectAt - now < 4f) { need |= _next.Needs; } if (!TryPump(need, Need.Bodies, _cBodies, now) && !TryPump(need, Need.Lights, _cLights, now) && !TryPump(need, Need.Sources, _cSources, now) && !TryPump(need, Need.Colliders, _cColliders, now)) { TryPump(need, Need.Tints, _cTints, now); } } private bool TryPump(Need mask, Need flag, Cache c, float now) { if ((mask & flag) == 0) { return false; } if (c.HasData && now - c.LastAt < c.Interval) { return false; } RunScan(c); return true; } private Rigidbody[] Bodies() { if (Stale(_cBodies, 4f)) { RunScan(_cBodies); } return _bodies; } private Light[] Lights() { if (Stale(_cLights, 10f)) { RunScan(_cLights); } return _lights; } private AudioSource[] Sources() { if (Stale(_cSources, 10f)) { RunScan(_cSources); } return _sources; } private Collider[] Colliders() { if (Stale(_cColliders, 10f)) { RunScan(_cColliders); } return _colliders; } private void ForEachBody(Action<Rigidbody> f) { Rigidbody[] array = Bodies(); foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null && !val.isKinematic) { f(val); _hit++; } } } private Vector3 CenterOfBodies() { //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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_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_0075: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; List<Transform> list = TargetRoots(); for (int i = 0; i < list.Count; i++) { if (!((Object)(object)list[i] == (Object)null)) { val += RootPos(list[i]); num++; } } if (num == 0) { Rigidbody[] array = Bodies(); foreach (Rigidbody val2 in array) { if ((Object)(object)val2 != (Object)null) { val += val2.position; num++; } } } if (num <= 0) { return Vector3.zero; } return val / (float)num; } private static Color CatColor(string cat) { //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) return (Color)(cat switch { "Gravity" => new Color(0.35f, 0.65f, 1f, 0.95f), "Time" => new Color(1f, 0.85f, 0.2f, 0.95f), "Physics" => new Color(1f, 0.4f, 0.3f, 0.95f), "Beasts" => new Color(0.4f, 0.9f, 0.45f, 0.95f), "World" => new Color(0.2f, 0.85f, 0.85f, 0.95f), "Camera" => new Color(0.9f, 0.5f, 1f, 0.95f), "Visual" => new Color(1f, 0.55f, 0.85f, 0.95f), "Audio" => new Color(0.7f, 0.75f, 0.9f, 0.95f), "Props" => new Color(1f, 0.6f, 0.2f, 0.95f), _ => new Color(0.8f, 0.8f, 0.8f, 0.95f), }); } private bool Pressed(KeyCode k) { //IL_0033: 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) bool result = false; if (_legacyOk) { try { result = Input.GetKeyDown(k); } catch (Exception) { _legacyOk = false; ((MelonBase)this).LoggerInstance.Msg("Old Input API is off in this game; reading hotkeys from the GUI event stream instead."); } } if (_pending.Remove(k)) { result = true; } return result; } private void CaptureKeys(Event ev) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_000a: 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_0018: 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) if ((int)ev.type == 4) { if ((int)ev.keyCode != 0 && _held.Add(ev.keyCode)) { _pending.Add(ev.keyCode); } } else if ((int)ev.type == 5) { _held.Remove(ev.keyCode); } } public override void OnGUI() { //IL_00c4: 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_0011: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_002d: 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_003b: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 Event current = Event.current; if (current == null) { return; } if ((int)current.type == 4 || (int)current.type == 5) { CaptureKeys(current); return; } if (_menuOpen && ((int)current.type == 0 || (int)current.type == 3 || (int)current.type == 1)) { try { MenuMouse(current); return; } catch (Exception ex) { if (_errLogged.Add("menu-click")) { ((MelonBase)this).LoggerInstance.Warning("Menu click failed: " + ex.Message); } return; } } if ((int)current.type != 7) { return; } try { DrawAll(); } catch (Exception ex2) { if (_errLogged.Add("gui")) { ((MelonBase)this).LoggerInstance.Error("Chaos GUI failed: " + ex2.Message); } } finally { GUI.color = Color.white; } } private void Guard(string name, Action act) { try { act(); } catch (Exception ex) { if (_errLogged.Add("gui-" + name)) { string text = ex.ToString(); ((MelonBase)this).LoggerInstance.Error("Chaos GUI part '" + name + "' failed: " + ((text.Length > 500) ? text.Substring(0, 500) : text)); } } } private void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (_style == null) { GUIStyle style = new GUIStyle(GUI.skin.label); GUIStyle big = new GUIStyle(GUI.skin.label); _style = style; _big = big; _mid = new GUIStyle(GUI.skin.label); } _style.fontSize = Mathf.RoundToInt(15f * _hudScale); _big.fontSize = Mathf.RoundToInt(32f * _hudScale); _mid.fontSize = Mathf.RoundToInt(21f * _hudScale); } private void DrawAll() { Guard("styles", EnsureStyles); if (_style == null || _big == null || _mid == null) { return; } Guard("messages", DrawMessages); if (Live) { if (_hudOn) { Guard("bars", DrawBars); } } else if (_hudOn && Time.unscaledTime < _offHintUntil) { Guard("hint", DrawOffHint); } if (_menuOpen) { Guard("menu", DrawMenu); } } private void DrawOffHint() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) DrawText(14f, (float)Screen.height - 30f * _hudScale, 520f, 26f * _hudScale, "Chaos mod is OFF. " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kToggle)/*cast due to .constrained prefix*/).ToString() + " = auto chaos, " + ((object)Unsafe.As<KeyCode, KeyCode>(ref _kMenu)/*cast due to .constrained prefix*/).ToString() + " = pick effects.", _style, new Color(1f, 1f, 1f, 0.8f)); } private void DrawMessages() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) float num = Screen.width; float num2 = Screen.height; float unscaledTime = Time.unscaledTime; float num3 = unscaledTime - _statusAt; if (num3 >= 0f && num3 <= _statusLen) { float num4 = Mathf.Clamp01((_statusLen - num3) / 0.6f); float num5 = Mathf.Min(num - 20f, (float)_status.Length * 32f * _hudScale * 0.55f + 40f); DrawText((num - num5) * 0.5f, num2 * 0.22f, num5 + 40f, 46f * _hudScale, _status, _big, new Color(_statusColor.r, _statusColor.g, _statusColor.b, num4)); } if (Live) { float num6 = unscaledTime - _toastAt; if (num6 >= 0f && num6 <= 3f) { float num7 = Mathf.Clamp01((3f - num6) / 0.8f); float num8 = Mathf.Min(num - 20f, (float)_toast.Length * 32f * _hudScale * 0.55f + 40f); DrawText((num - num8) * 0.5f, num2 * 0.22f + 52f * _hudScale, num8 + 40f, 46f * _hudScale, _toast, _big, new Color(_toastColor.r, _toastColor.g, _toastColor.b, num7)); } } } private void DrawBars() { //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) float num = Screen.width; float num2 = Screen.height; float unscaledTime = Time.unscaledTime; bool flag = IsPaused(); float hudScale = _hudScale; float num3 = 280f * hudScale; float num4 = 24f * hudScale; float num5 = 4f * hudScale; float num6 = 14f * hudScale; int num7 = (_enabled ? 1 : 0) + _active.Count; if (num7 != 0) { float num8 = (float)num7 * (num4 + num5); bool num9 = _hudCorner.EndsWith("Right", StringComparison.OrdinalIgnoreCase); bool flag2 = _hudCorner.StartsWith("Bottom", StringComparison.OrdinalIgnoreCase); float num10 = (num9 ? (num - num3 - num6) : num6); float num11 = (flag2 ? (num2 - num8 - num6) : num6); if (_enabled) { float num12 = Mathf.Max(0f, _nextEffectAt - unscaledTime); float fraction = (flag ? 0f : Mathf.Clamp01(1f - num12 / _span)); DrawBar(num10, num11, num3, num4, fraction, new Color(1f, 0.55f, 0.1f, 0.8f)); string text = (flag ? "CHAOS ON - waiting for a match" : ("NEXT CHAOS IN " + Mathf.CeilToInt(num12) + "s")); DrawText(num10 + 8f * hudScale, num11 + 2f * hudScale, num3, num4, text, _style, Color.white); num11 += num4 + num5; } for (int i = 0; i < _active.Count; i++) { ActiveEffect activeEffect = _active[i]; float num13 = Mathf.Max(0f, activeEffect.EndsAt - unscaledTime); Color val = CatColor(activeEffect.Effect.Category); DrawBar(num10, num11, num3, num4, Mathf.Clamp01(num13 / Mathf.Max(0.1f, activeEffect.Duration)), new Color(val.r, val.g, val.b, 0.75f)); DrawText(num10 + 8f * hudScale, num11 + 2f * hudScale, num3, num4, activeEffect.Effect.Name + " " + Mathf.CeilToInt(num13) + "s", _style, Color.white); num11 += num4 + num5; } } } private bool EnsureBarStyle() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (_textBars) { return false; } if (_barStyle != null) { return true; } try { GUIStyle val = new GUIStyle(); val.normal.background = Texture2D.whiteTexture; _barStyle = val; return true; } catch (Exception ex) { _textBars = true; ((MelonBase)this).LoggerInstance.Warning("Filled bars are not available in this game, using text bars: " + ex.Message); return false; } } private void DrawBox(float x, float y, float w, float h, Color col) { //IL_0009: 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_002a: Unknown result type (might be due to invalid IL or missing references) if (EnsureBarStyle()) { GUI.color = col; GUI.Label(new Rect(x, y, w, h), "", _barStyle); GUI.color = Color.white; } } private void DrawBar(float x, float y, float w, float h, float fraction, Color fill) { //IL_00dc: 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_0060: Unknown result type (might be due to invalid IL or missing references) fraction = Mathf.Clamp01(fraction); if (EnsureBarStyle()) { try { DrawBox(x, y, w, h, new Color(0f, 0f, 0f, 0.65f)); DrawBox(x + 2f, y + 2f, Mathf.Max(1f, (w - 4f) * fraction), h - 4f, fill); return; } catch (Exception ex) { _textBars = true; ((MelonBase)this).LoggerInstance.Warning("Filled bars failed, using text bars: " + ex.Message); } } int num = 10; int num2 = Mathf.RoundToInt((float)num * fraction); DrawText(x + w * 0.66f, y + 2f, w * 0.34f, h, "[" + new string('|', num2) + new string('.', num - num2) + "]", _style, fill); } private static void DrawText(float x, float y, float w, float h, string text, GUIStyle style, Color col) { //IL_000f: 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_0030: 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_0057: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0f, 0f, 0f, col.a); GUI.Label(new Rect(x + 1f, y + 1f, w, h), text, style); GUI.color = col; GUI.Label(new Rect(x, y, w, h), text, style); GUI.color = Color.white; } private void Add(string cat, string name, Need needs, Action start, Action tick = null, Action stop = null, string group = null, float durMul = 1f, Action late = null) { _all.Add(new ChaosEffect { Category = cat, Name = name, Needs = needs, OnStart = start, OnTick = tick, OnStop = stop, Group = group, DurMul = durMul, OnLate = late }); } private void BuildEffects() { Add("Gravity", "Moon Gravity", Need.None, delegate { //IL_0002: 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) SetGravity(GBase() * 0.2f); }, null, RestoreGravity, "gravity"); Add("Gravity", "Heavy Gravity", Need.None, delegate { //IL_0002: 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) SetGravity(GBase() * 3f); }, null, RestoreGravity, "gravity"); Add("Gravity", "Reverse Gravity", Need.None, delegate { //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_0011: Unknown result type (might be due to invalid IL or missing references) SetGravity(-GBase() * 0.5f); }, null, RestoreGravity, "gravity"); Add("Gravity", "Sideways Gravity", Need.None, delegate { //IL_0002: 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) SetGravity(new Vector3(GBase().y, 0f, 0f)); }, null, RestoreGravity, "gravity"); Add("Gravity", "Zero Gravity", Need.None, delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SetGravity(Vector3.zero); }, null, RestoreGravity, "gravity"); Add("Gravity", "Gravity Roulette", Need.None, delegate { //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) _rollG = Vector3.zero; }, delegate { //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_0024: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (_rollG == Vector3.zero || Time.frameCount % 150 == 0) { Vector3 onUnitSphere = Random.onUnitSphere; onUnitSphere.y = 0f - (Mathf.Abs(onUnitSphere.y) + 0.6f); Vector3 normalized = ((Vector3)(ref onUnitSphere)).normalized; Vector3 val = GBase(); _rollG = normalized * ((Vector3)(ref val)).magnitude; } SetGravity(Vector3.Lerp(Physics.gravity, _rollG, 0.04f)); }, RestoreGravity, "gravity"); Add("Gravity", "Gravity Waves", Need.None, null, delegate { //IL_0002: 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_0021: Unknown result type (might be due to invalid IL or missing references) SetGravity(GBase() * Mathf.Sin(Time.unscaledTime * 1.2f) * 0.9f); }, RestoreGravity, "gravity"); AddTime("Slow Motion", () => 0.4f, 1f); AddTime("Bullet Time", () => 0.15f, 0.5f); AddTime("Fast Forward", () => 1.8f, 1f); AddTime("Turbo Time", () => 2.5f, 0.6f); AddTime("Time Wobble", () => 1f + Mathf.Sin(Time.unscaledTime * 2f) * 0.6f, 1f); AddTime("Stutter Time", () => (Time.frameCount / 20 % 2 != 0) ? 0.2f : 1f, 0.7f); Add("Physics", "Launch Everyone", Need.Bodies, delegate { ForEachBody(delegate(Rigidbody rb) { //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) rb.AddForce(Vector3.up * 12f, (ForceMode)2); }); }, null, null, null, 0.15f); Add("Physics", "Super Jump", Need.Bodies, delegate { ForEachBody(delegate(Rigidbody rb) { //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) rb.AddForce(Vector3.up * 22f, (ForceMode)2); }); }, null, null, null, 0.15f); Add("Physics", "Yeet Sideways", Need.Bodies, delegate { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Vector3 onUnitSphere = Random.onUnitSphere; onUnitSphere.y = 0.3f; Vector3 push = ((Vector3)(ref onUnitSphere)).normalized * 14f; ForEachBody(delegate(Rigidbody rb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) rb.AddForce(push, (ForceMode)2); }); }, null, null, null, 0.15f); Add("Physics", "Spin Cycle", Need.Bodies, delegate { ForEachBody(delegate(Rigidbody rb) { //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) rb.angularVelocity = Random.onUnitSphere * 20f; }); }, null, null, null, 0.15f); Add("Physics", "Pinball", Need.Bodies, delegate { ForEachBody(delegate(Rigidbody rb) { //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) //IL_0008: 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_0025: Unknown result type (might be due to invalid IL or missing references) Vector3 onUnitSphere = Random.onUnitSphere; onUnitSphere.y = Mathf.Abs(onUnitSphere.y) * 0.5f; rb.AddForce(onUnitSphere * 11f, (ForceMode)2); }); }, null, null, null, 0.15f); Add("Physics", "Shockwave", Need.Bodies, delegate { //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) Vector3 center = CenterOfBodies(); ForEachBody(delegate(Rigidbody rb) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_004e: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Vector3 val = rb.position - center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Random.onUnitSphere; } Vector3 val2 = ((Vector3)(ref val)).normalized + Vector3.up * 0.6f; rb.AddForce(((Vector3)(ref val2)).normalized * 18f, (ForceMode)2); }); }, null, null, null, 0.15f); Add("Physics", "Implosion", Need.Bodies, delegate { //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) Vector3 center = CenterOfBodies(); ForEachBody(delegate(Rigidbody rb) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0049: 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) Vector3 val = center - rb.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { rb.AddForce(((Vector3)(ref val)).normalized * 12f + Vector3.up * 3f, (ForceMode)2); } }); }, null, null, null, 0.15f); Add("Physics", "Constant Wind", Need.Bodies, null, delegate { //IL_002c: 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) Vector3 wind = new Vector3(Mathf.Sin(Time.time * 0.5f), 0f, Mathf.Cos(Time.time * 0.5f)) * 25f; ForEachBody(delegate(Rigidbody rb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) rb.AddForce(wind, (ForceMode)5); }); }, null, "wind"); Add("Physics", "Magnet", Need.Bodies, null, delegate { //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) Vector3 center = CenterOfBodies(); ForEachBody(delegate(Rigidbody rb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Vector3 val = center - rb.position; rb.AddForce(((Vector3)(ref val)).normalized * 20f, (ForceMode)5); }); }, null, "wind"); Add("Physics", "Repulsor", Need.Bodies, null, delegate { //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) Vector3 center = CenterOfBodies(); ForEachBody(delegate(Rigidbody rb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Vector3 val = rb.position - center; rb.AddForce(((Vector3)(ref val)).normalized * 20f, (ForceMode)5); }); }, null, "wind"); Add("Physics", "Tornado", Need.Bodies, null, delegate { //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) Vector3 center = CenterOfBodies(); ForEachBody(delegate(Rigidbody rb) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = rb.position - center; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = normalized * 30f; val2 = -val; rb.AddForce(val3 + ((Vector3)(ref val2)).normalized * 10f + Vector3.up * 8f, (ForceMode)5); } }); }, null, "wind"); Add("Physics", "Jittery Everything", Need.Bodies, null, delegate { ForEachBody(delegate(Rigidbody rb) { //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) rb.AddForce(Random.insideUnitSphere * 15f, (ForceMode)5); }); }); Add("Physics", "Earthquake", Need.Bodies, null, delegate { ForEachBody(delegate(Rigidbody rb) { //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) //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_0018: 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) Vector2 insideUnitCircle = Random.insideUnitCircle; rb.AddForce(new Vector3(insideUnitCircle.x, 0.2f, insideUnitCircle.y) * 35f, (ForceMode)5); }); }, null, "quake"); Add("Beasts", "Feather Beasts", Need.Bodies, delegate { BodyPropsStart(0.25f, -1f, -1f); }, null, BodyPropsStop, "bodyprops"); Add("Beasts", "Lead Beasts", Need.Bodies, delegate { BodyPropsStart(5f, -1f, -1f); }, null, BodyPropsStop, "bodyprops"); Add("World", "Bouncy World", Need.Colliders, delegate { SwapColliderMaterial(1f, 0.6f, (PhysicMaterialCombine)3, (PhysicMaterialCombine)0); }, null, RestoreColliderMaterial, "physmat"); Add("World", "Slippery World", Need.Colliders, delegate { SwapColliderMaterial(0f, 0.02f, (PhysicMaterialCombine)0, (PhysicMaterialCombine)2); }, null, RestoreColliderMaterial, "physmat"); Add("World", "Sticky World", Need.Bodies | Need.Colliders, delegate { SwapColliderMaterial(0f, 4f, (PhysicMaterialCombine)2, (PhysicMaterialCombine)3); }, StickyTick, RestoreColliderMaterial, "physmat"); Add("Camera", "Wide Angle", Need.None, delegate { FovBegin(); FovSet(110f); }, null, FovEnd, "fov", 1f, delegate { FovSet(110f); }); Add("Camera", "Zoom Zoom", Need.None, delegate { FovBegin(); FovSet(25f); }, null, FovEnd, "fov", 1f, delegate { FovSet(25f); }); Add("Camera", "Fisheye", Need.None, delegate { FovBegin(); FovSet(140f); }, null, FovEnd, "fov", 1f, delegate { FovSet(140f); }); Add("Camera", "FOV Breathing", Need.None, FovBegin, null, FovEnd, "fov", 1f, delegate { FovSet(_fovBase + 22f * Mathf.Sin(Time.unscaledTime * 1.6f)); }); Add("Camera", "Drunk Camera", Need.None, null, null, delegate { SetRoll(0f); }, "roll", 1f, delegate { SetRoll(Mathf.Sin(Time.unscaledTime * 1.3f) * 14f); }); Add("Camera", "Dutch Angle", Need.None, null, null, delegate { SetRoll(0f); }, "roll", 1f, delegate { SetRoll(25f); }); Add("Camera", "Camera Shake", Need.None, null, null, delegate { SetRoll(0f); }, "roll", 0.5f, delegate { SetRoll((Mathf.PerlinNoise(Time.unscaledTime * 18f, 0.5f) - 0.5f) * 10f); }); Add("Camera", "Barrel Roll", Need.None, null, null, delegate { SetRoll(0f); }, "roll", 0.5f, delegate { SetRoll(Time.unscaledTime * 40f % 360f); }); Add("Visual", "Disco Lights", Need.Lights, delegate { LightsStart(null, 1f); }, delegate { LightsHue(Mathf.Repeat(Time.unscaledTime * 0.5f, 1f)); }, LightsRestore, "lights"); Add("Visual", "Blackout", Need.Lights, delegate { LightsStart(null, 0.1f); }, null, LightsRestore, "lights", 0.6f); Add("Visual", "Blinding Light", Need.Lights, delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) LightsStart(Color.white, 3f); }, null, LightsRestore, "lights", 0.6f); Add("Visual", "Sunset", Need.Lights, delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) LightsStart((Color?)new Color(1f, 0.55f, 0.25f), 1f); }, null, LightsRestore, "lights"); Add("Visual", "Toxic Glow", Need.Lights, delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) LightsStart((Color?)new Color(0.4f, 1f, 0.3f), 1.2f); }, null, LightsRestore, "lights"); Add("Audio", "Chipmunk Voices", Need.Sources, PitchStart, delegate { PitchTick(1.6f); }, PitchStop, "audio"); Add("Audio", "Deep Voices", Need.Sources, PitchStart, delegate { PitchTick(0.6f); }, PitchStop, "audio"); Add("Audio", "Silence", Need.None, SilenceStart, null, SilenceStop, "audio", 0.4f); Add("Props", "Prop Rain", Need.Bodies, null, delegate { //IL_000f: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount % 20 == 0) { SpawnProp((PrimitiveType)3, ScatterPos(CenterOfBodies(), 12f, 6f), Vector3.one * Random.Range(0.4f, 1.2f), RandomColor(), 1f, 20f); } }); Add("Props", "Capsule Storm", Need.Bodies, null, delegate { //IL_000f: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount % 12 == 0) { SpawnProp((PrimitiveType)1, ScatterPos(CenterOfBodies(), 14f, 8f), Vector3.one * Random.Range(0.6f, 1.1f), RandomColor(), 8f, 20f); } }); Add("Props", "Ball Pit", Need.Bodies, delegate { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 center = CenterOfBodies(); for (int i = 0; i < 25; i++) { SpawnProp((PrimitiveType)0, ScatterPos(center, 12f, 6f), Vector3.one * Random.Range(0.4f, 1.2f), RandomColor(), 1f, 25f); } }, null, null, null, 0.25f); Add("Props", "Anvil Drop", Need.Bodies, delegate { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) SpawnProp((PrimitiveType)3, CenterOfBodies() + Vector3.up * 15f, new Vector3(1.5f, 0.8f, 1f), new Color(0.2f, 0.2f, 0.22f), 80f, 30f); }, null, null, null, 0.25f); Add("Props", "Meteor Shower", Need.Bodies, null, delegate { //IL_000f: 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_002d: 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_0088: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount % 25 == 0) { Rigidbody component = SpawnProp((PrimitiveType)0, ScatterPos(CenterOfBodies(), 28f, 8f), Vector3.one * 1.2f, new Color(1f, 0.45f, 0.1f), 30f, 15f).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.velocity = new Vector3(Random.Range(-4f, 4f), -22f, Random.Range(-4f, 4f)); } } }); Add("Props", "Giant Beach Ball", Need.Bodies, delegate { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Collider component = SpawnProp((PrimitiveType)0, CenterOfBodies() + Vector3.up * 10f, Vector3.one * 3.5f, RandomColor(), 6f, 45f).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { component.sharedMaterial = BallMaterial(); } }, null, null, null, 0.3f); Add("Props", "Pillar Fall", Need.Bodies, delegate { //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_000e: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 center = CenterOfBodies(); for (int i = 0; i < 8; i++) { SpawnProp((PrimitiveType)2, ScatterPos(center, 14f, 7f), new Vector3(0.7f, 3f, 0.7f), RandomColor(), 40f, 25f); } }, null, null, null, 0.25f); Add("Props", "Incoming Object", Need.Bodies | Need.Beasts, delegate { //IL_0030: 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_0050: Unknown result type (might be due to invalid IL or missing references) switch (_rng.Next(3)) { case 0: ShootAtBeast((PrimitiveType)0, 1.6f, 60f, 28f, new Color(0.25f, 0.25f, 0.28f)); break; case 1: ShootAtBeast((PrimitiveType)3, 1.4f, 50f, 26f, RandomColor()); break; default: ShootAtBeast((PrimitiveType)2, 1.2f, 45f, 26f, RandomColor()); break; } }, null, null, null, 0.2f); Add("Props", "Object Barrage", Need.Bodies | Need.Beasts, null, delegate { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount % 100 == 0) { ShootAtBeast((PrimitiveType)0, 1.1f, 30f, 24f, RandomColor()); } }, null, null, 0.35f); Add("Beasts", "On Fire", Need.Bodies | Need.Tints | Need.Beasts, FireStart, FireTick, FireStop, "fire", 0.5f); Add("Props", "Bot Attack", Need.Bodies | Need.Beasts, delegate { BotsStart(3, 1.3f, 70f); }, BotsTick, BotsStop, "bots", 0.5f); Add("Props", "Bot Swarm", Need.Bodies | Need.Beasts, delegate { BotsStart(8, 0.8f, 25f); }, BotsTick, BotsStop, "bots", 0.4f); } private Vector3 GBase() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!_gravTouched) { return Physics.gravity; } return _gravBase; } private void SetGravity(Vector3 g) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!_gravTouched) { _gravBase = Physics.gravity; _gravTouched = true; } Physics.gravity = g; _hit++; } private void RestoreGravity() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (_gravTouched) { Physics.gravity = _gravBase; _gravTouched = false; } } private void AddTime(string name, Func<float> scale, float durMul) { Add("Time", name, Need.None, delegate { SetTime(scale()); }, delegate { SetTime(scale()); }, RestoreTime, "time", durMul, delegate { SetTime(scale()); }); } private void TimeHold() { if (_timeTouched && !(Time.timeScale <= 0.0001f) && Mathf.Abs(Time.timeScale - _timeWant) > 0.001f) { Time.timeScale = _timeWant; } } private void SetTime(float t) { if (!(Time.timeScale <= 0.0001f) || _timeTouched) { if (!_timeTouched) { _timeBase = Time.timeScale; _timeTouched = true; } if (!(Time.timeScale <= 0.0001f)) { _timeWant = t; Time.timeScale = t; _hit++; } } } private void RestoreTime() { if (_timeTouched) { Time.timeScale = _timeBase; _timeTouched = false; } } private void BodyPropsStart(float massMul, float drag, float angDrag) { BodyPropsStop(); Bodies(); for (int i = 0; i < _beastBodies.Count; i++) { Rigidbody val = _beastBodies[i]; if (!((Object)(object)val == (Object)null)) { _hit++; _pBodies.Add(val); _pMass.Add(val.mass); _pDrag.Add(v