using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Puzzlevision;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Main), "Puzzlevision", "0.2.0", "YourName", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Puzzlevision")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Puzzlevision")]
[assembly: AssemblyTitle("Puzzlevision")]
[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 Puzzlevision
{
public enum RemoteMode
{
Freeze,
Shrink,
Grow,
Yank,
Launch,
Reflect,
Mute,
Spin,
Float,
Duplicate,
PurpleZap
}
public class Main : MelonMod
{
private RemoteMode _mode;
private float _range = 25f;
private float _fireDelay;
private bool _loggedNoController;
private bool _loggedInputError;
private readonly HashSet<Rigidbody> _frozen = new HashSet<Rigidbody>();
private readonly HashSet<Rigidbody> _floating = new HashSet<Rigidbody>();
private readonly List<GameObject> _clones = new List<GameObject>();
private readonly List<GameObject> _zapped = new List<GameObject>();
private readonly List<GameObject> _beams = new List<GameObject>();
private readonly List<float> _beamTimers = new List<float>();
private float _stars;
private const float MaxStars = 5f;
private bool _showMeter;
private GameObject _meterRoot;
private readonly Renderer[] _starRenderers = (Renderer[])(object)new Renderer[5];
private bool _muted;
private float _volume = 1f;
private float _timeScale = 1f;
private float _ffTimer;
private const float FfScale = 2.5f;
private const float FfDuration = 3f;
private float _warpTimer;
private Vector3 _normalGravity;
private bool _zoneActive;
private Vector3 _zoneCenter;
private float _zoneRadius = 5f;
private float _zoneGravity;
private GameObject _zoneMarker;
private readonly HashSet<Rigidbody> _breakBodies = new HashSet<Rigidbody>();
private float _breakTimer;
private float _breakDuration = 5f;
private float _breakRadius = 40f;
private float _burstRadius = 15f;
private float _burstStrength = 1f;
private float _burstDuration = 6f;
private readonly HashSet<Rigidbody> _cueBodies = new HashSet<Rigidbody>();
private float _cueTimer;
private readonly Dictionary<Rigidbody, Vector3> _rewriteScales = new Dictionary<Rigidbody, Vector3>();
private float _rewriteTimer;
private readonly List<Vector3> _playerHistory = new List<Vector3>();
private readonly List<Dictionary<Rigidbody, (Vector3, Quaternion)>> _worldHistory = new List<Dictionary<Rigidbody, (Vector3, Quaternion)>>();
private float _recordTimer;
private float _rewindTimer;
private bool _rewinding;
private int _rewindSteps;
private float _rewindSeconds = 3f;
private float _rewindRadius = 15f;
private const float RecordInterval = 0.1f;
private const int MaxSnapshots = 100;
private GameObject _tv;
private bool _tvOn;
private float _tvFlicker;
private bool _selfScaled;
private bool Is5Star => _stars >= 4.99f;
private float PowerMult => 1f + _stars * 0.5f;
private int StepsToRewind => Mathf.Clamp(Mathf.RoundToInt(_rewindSeconds * 10f), 1, 100);
public override void OnInitializeMelon()
{
//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)
_normalGravity = Physics.gravity;
BuildMenu();
((MelonBase)this).LoggerInstance.Msg("Puzzlevision loaded. It's showtime!");
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
_playerHistory.Clear();
_worldHistory.Clear();
_frozen.Clear();
_floating.Clear();
_clones.Clear();
_zapped.Clear();
_beams.Clear();
_beamTimers.Clear();
_breakBodies.Clear();
_breakTimer = 0f;
_cueBodies.Clear();
_cueTimer = 0f;
_rewriteScales.Clear();
_rewriteTimer = 0f;
_ffTimer = 0f;
_tv = null;
_tvOn = false;
_zoneMarker = null;
_zoneActive = false;
_meterRoot = null;
_rewinding = false;
_selfScaled = false;
_normalGravity = Physics.gravity;
}
private void BuildMenu()
{
//IL_000a: 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_002e: 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_0088: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: 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)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: 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_037c: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_051a: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_057d: Unknown result type (might be due to invalid IL or missing references)
//IL_058f: Unknown result type (might be due to invalid IL or missing references)
//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Puzzlevision", Color.magenta, 0, true);
Page obj2 = obj.CreatePage("Remote", Color.cyan, 0, true);
obj2.CreateEnum("Remote Mode", Color.white, (Enum)_mode, (Action<Enum>)delegate(Enum v)
{
_mode = (RemoteMode)(object)v;
});
obj2.CreateFloat("Range", Color.white, 5f, _range, 5f, 100f, (Action<float>)delegate(float v)
{
_range = v;
});
obj2.CreateFunction("Max Out Ratings (5 stars)", Color.yellow, (Action)delegate
{
_stars = 5f;
});
obj2.CreateFunction("TEST: Fire Remote in 3s", Color.green, (Action)delegate
{
_fireDelay = 3f;
});
obj2.CreateFunction("Delete Duplicates", Color.red, (Action)DeleteClones);
obj2.CreateFunction("Restore Zapped Objects", Color.green, (Action)RestoreZapped);
Page obj3 = obj.CreatePage("Commercial Break", Color.yellow, 0, true);
obj3.CreateFunction("Start Commercial Break", Color.yellow, (Action)StartBreak);
obj3.CreateFunction("End Break Early", Color.green, (Action)EndBreak);
obj3.CreateFloat("Duration (s)", Color.white, 1f, _breakDuration, 1f, 30f, (Action<float>)delegate(float v)
{
_breakDuration = v;
});
obj3.CreateFloat("Radius (m)", Color.white, 5f, _breakRadius, 5f, 150f, (Action<float>)delegate(float v)
{
_breakRadius = v;
});
Page obj4 = obj.CreatePage("Burst Powers", Color.red, 0, true);
obj4.CreateFunction("Plot Twist", Color.white, (Action)PlotTwist);
obj4.CreateFunction("Shockwave", Color.red, (Action)Shockwave);
obj4.CreateFunction("Vacuum", Color.cyan, (Action)Vacuum);
obj4.CreateFunction("Cue the Floating", Color.blue, (Action)CueFloating);
obj4.CreateFunction("Script Rewrite", Color.magenta, (Action)ScriptRewrite);
obj4.CreateFunction("Undo Floating + Rewrite Now", Color.green, (Action)delegate
{
EndCue();
EndScriptRewrite();
});
obj4.CreateFloat("Radius (m)", Color.white, 5f, _burstRadius, 5f, 100f, (Action<float>)delegate(float v)
{
_burstRadius = v;
});
obj4.CreateFloat("Strength", Color.white, 0.25f, _burstStrength, 0.25f, 3f, (Action<float>)delegate(float v)
{
_burstStrength = v;
});
obj4.CreateFloat("Float/Rewrite Duration (s)", Color.white, 1f, _burstDuration, 1f, 30f, (Action<float>)delegate(float v)
{
_burstDuration = v;
});
Page obj5 = obj.CreatePage("Time", Color.blue, 0, true);
obj5.CreateFloat("Time Scale", Color.white, 0.05f, 1f, 0.05f, 1.5f, (Action<float>)delegate(float v)
{
_timeScale = v;
if (_ffTimer <= 0f)
{
ApplyTimeScale(v);
}
});
obj5.CreateFunction("Fast Forward (3s)", Color.cyan, (Action)StartFastForward);
obj5.CreateFunction("Rewind", Color.yellow, (Action)StartRewind);
obj5.CreateFloat("Rewind Length (s)", Color.white, 1f, _rewindSeconds, 1f, 10f, (Action<float>)delegate(float v)
{
_rewindSeconds = v;
});
obj5.CreateFloat("Rewind Radius (m)", Color.white, 5f, _rewindRadius, 5f, 100f, (Action<float>)delegate(float v)
{
_rewindRadius = v;
});
Page obj6 = obj.CreatePage("Audio Control", Color.green, 0, true);
obj6.CreateBool("Mute Everything", Color.white, false, (Action<bool>)delegate(bool v)
{
_muted = v;
ApplyAudio();
});
obj6.CreateFloat("Volume", Color.white, 0.1f, 1f, 0f, 1f, (Action<float>)delegate(float v)
{
_volume = v;
ApplyAudio();
});
Page obj7 = obj.CreatePage("Reality Warp", Color.red, 0, true);
obj7.CreateFloat("Gravity", Color.white, 1f, 9.81f, -20f, 30f, (Action<float>)delegate(float v)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
Physics.gravity = new Vector3(0f, 0f - v, 0f);
});
obj7.CreateFunction("Scene Glitch (5s)", Color.white, (Action)delegate
{
_warpTimer = 5f;
});
obj7.CreateFunction("Reset Reality", Color.green, (Action)ResetReality);
Page obj8 = obj.CreatePage("Gravity Zone", Color.magenta, 0, true);
obj8.CreateFunction("Place Zone Where I'm Looking", Color.white, (Action)PlaceZone);
obj8.CreateFunction("Remove Zone", Color.red, (Action)RemoveZone);
obj8.CreateFloat("Zone Gravity (0 = zero-g)", Color.white, 1f, _zoneGravity, -20f, 30f, (Action<float>)delegate(float v)
{
_zoneGravity = v;
});
obj8.CreateFloat("Zone Radius (m)", Color.white, 1f, _zoneRadius, 1f, 30f, (Action<float>)delegate(float v)
{
_zoneRadius = v;
});
Page obj9 = obj.CreatePage("Television", Color.white, 0, true);
obj9.CreateFunction("Toggle Puzzlevision TV", Color.white, (Action)ToggleTv);
obj9.CreateFunction("Teleport To TV", Color.white, (Action)TeleportToTv);
Page obj10 = obj.CreatePage("Player", Color.cyan, 0, true);
obj10.CreateBool("Show Ratings Meter", Color.yellow, false, (Action<bool>)SetMeter);
obj10.CreateFloat("Self Size (EXPERIMENTAL)", Color.red, 0.25f, 1f, 0.25f, 3f, (Action<float>)SetSelfSize);
}
public override void OnUpdate()
{
float unscaledDeltaTime = Time.unscaledDeltaTime;
if (_stars > 0f)
{
_stars = Mathf.Max(0f, _stars - 0.05f * unscaledDeltaTime);
}
if (_fireDelay > 0f)
{
_fireDelay -= unscaledDeltaTime;
if (_fireDelay <= 0f)
{
FireRemote();
}
}
HandleInput();
RecordHistory(unscaledDeltaTime);
UpdateRewind(unscaledDeltaTime);
UpdateWarp(unscaledDeltaTime);
UpdateTv(unscaledDeltaTime);
UpdateBreak(unscaledDeltaTime);
UpdateBursts(unscaledDeltaTime);
UpdateBeams(unscaledDeltaTime);
UpdateFastForward(unscaledDeltaTime);
UpdateMeter();
}
public override void OnFixedUpdate()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (!_zoneActive)
{
return;
}
Vector3 val = new Vector3(0f, 0f - _zoneGravity, 0f) - Physics.gravity;
HashSet<Rigidbody> hashSet = new HashSet<Rigidbody>();
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(_zoneCenter, _zoneRadius))
{
Rigidbody attachedRigidbody = item.attachedRigidbody;
if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && attachedRigidbody.useGravity && hashSet.Add(attachedRigidbody))
{
attachedRigidbody.AddForce(val, (ForceMode)5);
}
}
}
private void HandleInput()
{
try
{
BaseController rightController = Player.RightController;
if ((Object)(object)rightController == (Object)null)
{
if (!_loggedNoController)
{
((MelonBase)this).LoggerInstance.Warning("Player.RightController is null");
_loggedNoController = true;
}
return;
}
if (rightController.GetPrimaryInteractionButtonDown())
{
((MelonBase)this).LoggerInstance.Msg("Right 'primary' button pressed -> fire remote");
FireRemote();
}
if (rightController.GetSecondaryInteractionButtonDown())
{
((MelonBase)this).LoggerInstance.Msg("Right 'secondary' button pressed -> next mode");
CycleMode();
}
}
catch (Exception ex)
{
if (!_loggedInputError)
{
((MelonBase)this).LoggerInstance.Error("Input error: " + ex);
_loggedInputError = true;
}
}
}
private Transform RigRoot()
{
RigManager rigManager = Player.RigManager;
if (!((Object)(object)rigManager != (Object)null))
{
return null;
}
return ((Component)rigManager).transform;
}
private bool IsPlayerBody(Transform t)
{
Transform val = RigRoot();
if ((Object)(object)val != (Object)null && (Object)(object)t != (Object)null)
{
return t.IsChildOf(val);
}
return false;
}
private GameObject MakePrim(PrimitiveType type, string name, Vector3 scale, Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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: Expected O, but got Unknown
GameObject obj = GameObject.CreatePrimitive(type);
((Object)obj).name = name;
obj.transform.localScale = scale;
Collider component = obj.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
component.enabled = false;
}
Renderer component2 = obj.GetComponent<Renderer>();
if ((Object)(object)component2 != (Object)null)
{
Shader val = Shader.Find("Unlit/Color");
if ((Object)(object)val == (Object)null)
{
val = Shader.Find("Sprites/Default");
}
if ((Object)(object)val != (Object)null)
{
component2.material = new Material(val);
}
component2.material.color = color;
}
return obj;
}
private void ApplyTimeScale(float s)
{
Time.timeScale = s;
Time.fixedDeltaTime = 0.02f * s;
}
private void ApplyAudio()
{
AudioListener.volume = (_muted ? 0f : _volume);
}
private void AddRating(float amount)
{
_stars = Mathf.Min(5f, _stars + amount);
if (Is5Star)
{
((MelonBase)this).LoggerInstance.Msg("5 STARS! Powers amplified.");
}
}
private void CycleMode()
{
_mode = (RemoteMode)((int)(_mode + 1) % Enum.GetValues(typeof(RemoteMode)).Length);
((MelonBase)this).LoggerInstance.Msg($"Remote mode: {_mode}");
}
private void FireRemote()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
((MelonBase)this).LoggerInstance.Warning("Remote: Camera.main is null");
return;
}
Vector3 position = ((Component)main).transform.position;
Vector3 forward = ((Component)main).transform.forward;
float num = _range * (Is5Star ? 2f : 1f);
float num2 = float.MaxValue;
Rigidbody val = null;
string text = null;
Vector3 to = position + forward * num;
foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(position, forward, num))
{
RaycastHit current = item;
if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !IsPlayerBody(((Component)((RaycastHit)(ref current)).collider).transform) && !(((RaycastHit)(ref current)).distance >= num2))
{
num2 = ((RaycastHit)(ref current)).distance;
val = ((RaycastHit)(ref current)).rigidbody;
text = ((Object)((RaycastHit)(ref current)).collider).name;
to = ((RaycastHit)(ref current)).point;
}
}
if (text == null)
{
((MelonBase)this).LoggerInstance.Msg("Remote: nothing in range in front of you");
return;
}
if ((Object)(object)val == (Object)null)
{
((MelonBase)this).LoggerInstance.Msg("Remote: hit '" + text + "' but it has no Rigidbody (can't move it)");
return;
}
((MelonBase)this).LoggerInstance.Msg($"Remote: {_mode} on '{((Object)val).name}'");
switch (_mode)
{
case RemoteMode.Freeze:
if (_frozen.Contains(val))
{
Unfreeze(val);
break;
}
_frozen.Add(val);
val.velocity = Vector3.zero;
val.angularVelocity = Vector3.zero;
val.isKinematic = true;
break;
case RemoteMode.Shrink:
{
Transform transform2 = ((Component)val).transform;
transform2.localScale *= 0.7f;
break;
}
case RemoteMode.Grow:
{
Transform transform = ((Component)val).transform;
transform.localScale *= 1.4f;
break;
}
case RemoteMode.Yank:
Unfreeze(val);
val.position = position + forward * 1.5f;
val.velocity = Vector3.zero;
break;
case RemoteMode.Launch:
Unfreeze(val);
val.AddForce(forward * 25f * PowerMult, (ForceMode)2);
break;
case RemoteMode.Reflect:
{
Unfreeze(val);
Rigidbody obj = val;
Vector3 val2 = -forward;
Vector3 velocity = val.velocity;
obj.velocity = val2 * Mathf.Max(((Vector3)(ref velocity)).magnitude, 15f) * PowerMult;
break;
}
case RemoteMode.Mute:
ToggleMuteOn(val);
break;
case RemoteMode.Spin:
Unfreeze(val);
val.angularVelocity = Random.onUnitSphere * 12f * PowerMult;
break;
case RemoteMode.Float:
ToggleFloat(val);
break;
case RemoteMode.Duplicate:
Duplicate(val);
break;
case RemoteMode.PurpleZap:
PurpleZap(val, position + forward * 0.4f + Vector3.down * 0.2f, to);
break;
}
AddRating(0.2f);
}
private void Unfreeze(Rigidbody rb)
{
if (_frozen.Remove(rb))
{
rb.isKinematic = false;
}
}
private void ToggleMuteOn(Rigidbody rb)
{
bool? flag = null;
foreach (AudioSource componentsInChild in ((Component)rb).GetComponentsInChildren<AudioSource>())
{
if (!flag.HasValue)
{
flag = !componentsInChild.mute;
}
componentsInChild.mute = flag.Value;
}
if (!flag.HasValue)
{
((MelonBase)this).LoggerInstance.Msg("Remote: that object has no audio to mute");
}
}
private void ToggleFloat(Rigidbody rb)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
if (_floating.Remove(rb))
{
rb.useGravity = true;
return;
}
_floating.Add(rb);
Unfreeze(rb);
rb.useGravity = false;
rb.velocity = Vector3.up * 0.5f;
rb.angularVelocity = Random.onUnitSphere * 0.5f;
}
private void Duplicate(Rigidbody rb)
{
//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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject val = Object.Instantiate<GameObject>(((Component)rb).gameObject, rb.position + Vector3.up * 0.4f, rb.rotation);
if ((Object)(object)val != (Object)null)
{
((Object)val).name = ((Object)rb).name + " (rerun)";
_clones.Add(val);
}
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Error("Duplicate failed: " + ex.Message);
}
}
private void DeleteClones()
{
foreach (GameObject clone in _clones)
{
if ((Object)(object)clone != (Object)null)
{
Object.Destroy((Object)(object)clone);
}
}
_clones.Clear();
}
private void PurpleZap(Rigidbody rb, Vector3 from, Vector3 to)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
SpawnBeam(from, to);
Unfreeze(rb);
_floating.Remove(rb);
GameObject gameObject = ((Component)rb).gameObject;
_zapped.Add(gameObject);
gameObject.SetActive(false);
}
private void RestoreZapped()
{
foreach (GameObject item in _zapped)
{
if ((Object)(object)item != (Object)null)
{
item.SetActive(true);
}
}
_zapped.Clear();
}
private void SpawnBeam(Vector3 from, Vector3 to)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0050: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = to - from;
float magnitude = ((Vector3)(ref val)).magnitude;
if (!(magnitude < 0.05f))
{
GameObject val2 = MakePrim((PrimitiveType)3, "PurpleZap", new Vector3(0.04f, 0.04f, magnitude), new Color(0.65f, 0.1f, 1f));
val2.transform.position = from + val * 0.5f;
val2.transform.rotation = Quaternion.LookRotation(val);
_beams.Add(val2);
_beamTimers.Add(0.25f);
}
}
private void UpdateBeams(float dt)
{
for (int num = _beams.Count - 1; num >= 0; num--)
{
_beamTimers[num] -= dt;
if (!(_beamTimers[num] > 0f))
{
if ((Object)(object)_beams[num] != (Object)null)
{
Object.Destroy((Object)(object)_beams[num]);
}
_beams.RemoveAt(num);
_beamTimers.RemoveAt(num);
}
}
}
private void StartBreak()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
EndBreak();
RigManager rigManager = Player.RigManager;
if ((Object)(object)rigManager == (Object)null)
{
return;
}
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(((Component)rigManager).transform.position, _breakRadius))
{
Rigidbody attachedRigidbody = item.attachedRigidbody;
if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && !IsPlayerBody(((Component)attachedRigidbody).transform) && _breakBodies.Add(attachedRigidbody))
{
attachedRigidbody.velocity = Vector3.zero;
attachedRigidbody.angularVelocity = Vector3.zero;
attachedRigidbody.isKinematic = true;
}
}
_breakTimer = _breakDuration;
AddRating(0.3f);
((MelonBase)this).LoggerInstance.Msg($"Commercial break! Froze {_breakBodies.Count} objects.");
}
private void EndBreak()
{
foreach (Rigidbody breakBody in _breakBodies)
{
if ((Object)(object)breakBody != (Object)null && !_frozen.Contains(breakBody))
{
breakBody.isKinematic = false;
}
}
_breakBodies.Clear();
_breakTimer = 0f;
}
private void UpdateBreak(float dt)
{
if (!(_breakTimer <= 0f))
{
_breakTimer -= dt;
if (_breakTimer <= 0f)
{
EndBreak();
((MelonBase)this).LoggerInstance.Msg("We're back!");
}
}
}
private bool BurstOrigin(out Vector3 origin)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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)
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
origin = ((Component)main).transform.position;
return true;
}
RigManager rigManager = Player.RigManager;
if ((Object)(object)rigManager != (Object)null)
{
origin = ((Component)rigManager).transform.position;
return true;
}
origin = Vector3.zero;
return false;
}
private List<Rigidbody> NearbyBodies(Vector3 center, float radius)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
List<Rigidbody> list = new List<Rigidbody>();
HashSet<Rigidbody> hashSet = new HashSet<Rigidbody>();
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(center, radius))
{
Rigidbody attachedRigidbody = item.attachedRigidbody;
if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && !IsPlayerBody(((Component)attachedRigidbody).transform) && hashSet.Add(attachedRigidbody))
{
list.Add(attachedRigidbody);
}
}
return list;
}
private void PlotTwist()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007f: Unknown result type (might be due to invalid IL or missing references)
if (!BurstOrigin(out var origin))
{
return;
}
List<Rigidbody> list = NearbyBodies(origin, _burstRadius);
foreach (Rigidbody item in list)
{
Vector3 val = Random.onUnitSphere * 8f * _burstStrength * PowerMult + Vector3.up * 3f;
item.AddForce(Vector3.ClampMagnitude(val, 50f), (ForceMode)2);
item.angularVelocity = Random.onUnitSphere * 6f;
}
((MelonBase)this).LoggerInstance.Msg($"Plot twist! Shook up {list.Count} objects.");
AddRating(0.3f);
}
private void Shockwave()
{
//IL_000c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
if (!BurstOrigin(out var origin))
{
return;
}
List<Rigidbody> list = NearbyBodies(origin, _burstRadius);
foreach (Rigidbody item in list)
{
Vector3 val = item.position - origin;
float magnitude = ((Vector3)(ref val)).magnitude;
val = ((magnitude > 0.01f) ? (val / magnitude) : Vector3.up);
float num = Mathf.Clamp(1f - magnitude / _burstRadius, 0.2f, 1f);
Vector3 val2 = val + Vector3.up * 0.3f;
Vector3 val3 = ((Vector3)(ref val2)).normalized * 20f * _burstStrength * PowerMult * num;
item.AddForce(Vector3.ClampMagnitude(val3, 50f), (ForceMode)2);
}
((MelonBase)this).LoggerInstance.Msg($"Shockwave hit {list.Count} objects.");
AddRating(0.3f);
}
private void Vacuum()
{
//IL_000c: 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)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
if (!BurstOrigin(out var origin))
{
return;
}
List<Rigidbody> list = NearbyBodies(origin, _burstRadius);
foreach (Rigidbody item in list)
{
Vector3 val = origin - item.position;
float magnitude = ((Vector3)(ref val)).magnitude;
if (!(magnitude < 0.01f))
{
float num = Mathf.Min(Mathf.Clamp(magnitude * 1.5f, 3f, 20f) * _burstStrength * PowerMult, 40f);
item.velocity = val / magnitude * num;
}
}
((MelonBase)this).LoggerInstance.Msg($"Vacuum pulled {list.Count} objects.");
AddRating(0.3f);
}
private void CueFloating()
{
//IL_0012: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
if (!BurstOrigin(out var origin))
{
return;
}
EndCue();
foreach (Rigidbody item in NearbyBodies(origin, _burstRadius))
{
if (item.useGravity)
{
_cueBodies.Add(item);
item.useGravity = false;
item.AddForce(Vector3.up * 1.5f + Random.onUnitSphere * 0.5f, (ForceMode)2);
}
}
_cueTimer = _burstDuration;
((MelonBase)this).LoggerInstance.Msg($"Cue the floating! {_cueBodies.Count} objects.");
AddRating(0.3f);
}
private void EndCue()
{
foreach (Rigidbody cueBody in _cueBodies)
{
if ((Object)(object)cueBody != (Object)null && !_floating.Contains(cueBody))
{
cueBody.useGravity = true;
}
}
_cueBodies.Clear();
_cueTimer = 0f;
}
private void ScriptRewrite()
{
//IL_000c: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (!BurstOrigin(out var origin))
{
return;
}
List<Rigidbody> list = NearbyBodies(origin, _burstRadius);
foreach (Rigidbody item in list)
{
if (!_rewriteScales.ContainsKey(item))
{
_rewriteScales[item] = ((Component)item).transform.localScale;
}
((Component)item).transform.localScale = _rewriteScales[item] * Random.Range(0.4f, 2.2f);
}
_rewriteTimer = _burstDuration;
((MelonBase)this).LoggerInstance.Msg($"Script rewrite! Resized {list.Count} objects.");
AddRating(0.3f);
}
private void EndScriptRewrite()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<Rigidbody, Vector3> rewriteScale in _rewriteScales)
{
if ((Object)(object)rewriteScale.Key != (Object)null)
{
((Component)rewriteScale.Key).transform.localScale = rewriteScale.Value;
}
}
_rewriteScales.Clear();
_rewriteTimer = 0f;
}
private void UpdateBursts(float dt)
{
if (_cueTimer > 0f)
{
_cueTimer -= dt;
if (_cueTimer <= 0f)
{
EndCue();
}
}
if (_rewriteTimer > 0f)
{
_rewriteTimer -= dt;
if (_rewriteTimer <= 0f)
{
EndScriptRewrite();
}
}
}
private void StartFastForward()
{
_ffTimer = 3f;
Time.timeScale = 2.5f;
AddRating(0.2f);
}
private void UpdateFastForward(float dt)
{
if (!(_ffTimer <= 0f))
{
_ffTimer -= dt;
if (_ffTimer <= 0f)
{
ApplyTimeScale(_timeScale);
}
}
}
private void RecordHistory(float dt)
{
//IL_0046: 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_00c5: 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_009c: Unknown result type (might be due to invalid IL or missing references)
if (_rewinding)
{
return;
}
_recordTimer += dt;
if (_recordTimer < 0.1f)
{
return;
}
_recordTimer = 0f;
RigManager rigManager = Player.RigManager;
if ((Object)(object)rigManager == (Object)null)
{
return;
}
Vector3 position = ((Component)rigManager).transform.position;
Dictionary<Rigidbody, (Vector3, Quaternion)> dictionary = new Dictionary<Rigidbody, (Vector3, Quaternion)>();
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(position, _rewindRadius))
{
Rigidbody attachedRigidbody = item.attachedRigidbody;
if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && !dictionary.ContainsKey(attachedRigidbody))
{
dictionary[attachedRigidbody] = (attachedRigidbody.position, attachedRigidbody.rotation);
}
}
_playerHistory.Add(position);
_worldHistory.Add(dictionary);
if (_playerHistory.Count > 100)
{
_playerHistory.RemoveAt(0);
_worldHistory.RemoveAt(0);
}
}
private void StartRewind()
{
if (_playerHistory.Count >= 3)
{
_rewinding = true;
_rewindTimer = 0f;
_rewindSteps = 0;
AddRating(0.5f);
}
}
private void UpdateRewind(float dt)
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00b0: 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)
if (!_rewinding)
{
return;
}
_rewindTimer += dt;
if (_rewindTimer < 0.03f)
{
return;
}
_rewindTimer = 0f;
if (_playerHistory.Count == 0)
{
_rewinding = false;
return;
}
int index = _playerHistory.Count - 1;
foreach (KeyValuePair<Rigidbody, (Vector3, Quaternion)> item in _worldHistory[index])
{
Rigidbody key = item.Key;
if (!((Object)(object)key == (Object)null))
{
key.position = item.Value.Item1;
key.rotation = item.Value.Item2;
key.velocity = Vector3.zero;
key.angularVelocity = Vector3.zero;
}
}
try
{
Player.RigManager.Teleport(_playerHistory[index], true);
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Error(ex.Message);
}
_playerHistory.RemoveAt(index);
_worldHistory.RemoveAt(index);
_rewindSteps++;
if (_rewindSteps >= StepsToRewind || _playerHistory.Count == 0)
{
_rewinding = false;
}
}
private void UpdateWarp(float dt)
{
//IL_0026: 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_0048: Unknown result type (might be due to invalid IL or missing references)
if (!(_warpTimer <= 0f))
{
_warpTimer -= dt;
if (Time.frameCount % 45 == 0)
{
Physics.gravity = Random.onUnitSphere * 9.81f;
}
if (_warpTimer <= 0f)
{
Physics.gravity = _normalGravity;
}
}
}
private void ResetReality()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
_warpTimer = 0f;
Physics.gravity = _normalGravity;
_ffTimer = 0f;
_timeScale = 1f;
ApplyTimeScale(1f);
_muted = false;
_volume = 1f;
AudioListener.volume = 1f;
EndBreak();
EndCue();
EndScriptRewrite();
RestoreZapped();
RemoveZone();
foreach (Rigidbody item in new List<Rigidbody>(_frozen))
{
if ((Object)(object)item != (Object)null)
{
item.isKinematic = false;
}
}
_frozen.Clear();
foreach (Rigidbody item2 in new List<Rigidbody>(_floating))
{
if ((Object)(object)item2 != (Object)null)
{
item2.useGravity = true;
}
}
_floating.Clear();
SetSelfSize(1f);
}
private void PlaceZone()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return;
}
Vector3 position = ((Component)main).transform.position;
Vector3 forward = ((Component)main).transform.forward;
float num = 5f;
float num2 = float.MaxValue;
foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(position, forward, 30f))
{
RaycastHit current = item;
if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !IsPlayerBody(((Component)((RaycastHit)(ref current)).collider).transform) && ((RaycastHit)(ref current)).distance < num2)
{
num2 = ((RaycastHit)(ref current)).distance;
}
}
if (num2 < 30f)
{
num = Mathf.Max(1f, num2 - 0.3f);
}
_zoneCenter = position + forward * num;
_zoneActive = true;
if ((Object)(object)_zoneMarker == (Object)null)
{
_zoneMarker = MakePrim((PrimitiveType)0, "PuzzlevisionZone", Vector3.one * 0.25f, Color.cyan);
}
_zoneMarker.SetActive(true);
_zoneMarker.transform.position = _zoneCenter;
AddRating(0.2f);
}
private void RemoveZone()
{
_zoneActive = false;
if ((Object)(object)_zoneMarker != (Object)null)
{
_zoneMarker.SetActive(false);
}
}
private void SetMeter(bool on)
{
_showMeter = on;
if ((Object)(object)_meterRoot != (Object)null)
{
_meterRoot.SetActive(on);
}
}
private void BuildMeter()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0027: 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)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
_meterRoot = new GameObject("PuzzlevisionRatings");
for (int i = 0; i < 5; i++)
{
GameObject val = MakePrim((PrimitiveType)3, "Star" + i, Vector3.one * 0.05f, Color.gray);
val.transform.SetParent(_meterRoot.transform, false);
val.transform.localPosition = new Vector3((float)(i - 2) * 0.075f, 0f, 0f);
_starRenderers[i] = val.GetComponent<Renderer>();
}
}
private void UpdateMeter()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
if (!_showMeter)
{
return;
}
if ((Object)(object)_meterRoot == (Object)null)
{
BuildMeter();
}
Camera main = Camera.main;
if ((Object)(object)main == (Object)null || (Object)(object)_meterRoot == (Object)null)
{
return;
}
_meterRoot.SetActive(true);
_meterRoot.transform.position = ((Component)main).transform.position + ((Component)main).transform.forward * 0.9f + ((Component)main).transform.up * 0.28f;
_meterRoot.transform.rotation = Quaternion.LookRotation(((Component)main).transform.forward, ((Component)main).transform.up);
Color val = default(Color);
((Color)(ref val))..ctor(1f, 0.85f, 0.1f);
for (int i = 0; i < 5; i++)
{
Renderer val2 = _starRenderers[i];
if (!((Object)(object)val2 == (Object)null))
{
float num = Mathf.Clamp01(_stars - (float)i);
Color color = Color.Lerp(Color.gray, val, num);
if (Is5Star)
{
color = Color.Lerp(val, Color.magenta, 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 8f));
}
val2.material.color = color;
}
}
}
private void SetSelfSize(float s)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
try
{
RigManager rigManager = Player.RigManager;
if (!((Object)(object)rigManager == (Object)null) && (_selfScaled || !Mathf.Approximately(s, 1f)))
{
((Component)rigManager).transform.localScale = Vector3.one * s;
_selfScaled = !Mathf.Approximately(s, 1f);
}
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Error("Self size failed: " + ex.Message);
}
}
private void ToggleTv()
{
//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_0082: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
Camera main = Camera.main;
if (!((Object)(object)main == (Object)null))
{
if ((Object)(object)_tv == (Object)null)
{
_tv = MakePrim((PrimitiveType)3, "PuzzlevisionTV", new Vector3(1.6f, 0.9f, 0.12f), Color.magenta);
}
_tvOn = !_tvOn;
_tv.SetActive(_tvOn);
if (_tvOn)
{
_tv.transform.position = ((Component)main).transform.position + ((Component)main).transform.forward * 2.5f;
_tv.transform.LookAt(((Component)main).transform.position);
_tv.transform.Rotate(0f, 180f, 0f);
}
}
}
private void UpdateTv(float dt)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
if (_tvOn && !((Object)(object)_tv == (Object)null))
{
_tvFlicker += dt * 12f;
Renderer component = _tv.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
float num = 0.5f + 0.5f * Mathf.Sin(_tvFlicker);
component.material.color = Color.Lerp(Color.magenta, Color.cyan, num);
}
}
}
private void TeleportToTv()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_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 (!_tvOn || (Object)(object)_tv == (Object)null)
{
return;
}
try
{
Player.RigManager.Teleport(_tv.transform.position + Vector3.up * 0.2f, true);
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Error(ex.Message);
}
}
}
}