using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ASMod;
using ASMod.Modes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow.AI;
using MelonLoader;
using UnityEngine;
using UnityEngine.XR;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(AS), "Absolute Solver", "1.0.0", "Author", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AS")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AS")]
[assembly: AssemblyTitle("AS")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ASMod
{
public sealed class AS : MelonMod
{
private GameObject _leftHost;
private GameObject _rightHost;
public override void OnInitializeMelon()
{
ClassInjector.RegisterTypeInIl2Cpp<ASController>();
MelonLogger.Msg("[AS] Absolute Solver initialized successfully.");
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
if ((Object)(object)_leftHost == (Object)null)
{
_leftHost = new GameObject("AS_LeftHand_Host");
Object.DontDestroyOnLoad((Object)(object)_leftHost);
_leftHost.AddComponent<ASController>().IsLeftHand = true;
}
if ((Object)(object)_rightHost == (Object)null)
{
_rightHost = new GameObject("AS_RightHand_Host");
Object.DontDestroyOnLoad((Object)(object)_rightHost);
_rightHost.AddComponent<ASController>().IsLeftHand = false;
}
MelonLogger.Msg("[AS] Hosts created in scene: " + sceneName);
}
}
public class ASController : MonoBehaviour
{
private bool _enabled;
private int _mode = 1;
private float _bPressTimer;
private int _bClickCount;
private bool _lastBState;
private ASHologramManager _holoManager;
private Transform _handTransform;
private ASTelekinesis _telekinesis;
private ASNullSingularity _nullSingularity;
private ASCoordinateSwap _coordinateSwap;
private ASSolutionEye _solutionEye;
public bool IsLeftHand { get; set; }
public ASController(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
_holoManager = new ASHologramManager();
_telekinesis = new ASTelekinesis();
_nullSingularity = new ASNullSingularity();
_coordinateSwap = new ASCoordinateSwap();
_solutionEye = new ASSolutionEye();
}
private void Update()
{
//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_010b: Unknown result type (might be due to invalid IL or missing references)
FindHandTransform();
HandleInput();
if (_enabled && (Object)(object)_handTransform != (Object)null)
{
ASHologramManager.SolverMode newMode = ASHologramManager.SolverMode.Common;
if (_mode == 1)
{
newMode = (_telekinesis.IsSpinning ? ASHologramManager.SolverMode.Spin : ASHologramManager.SolverMode.Common);
}
else if (_mode == 2)
{
newMode = ASHologramManager.SolverMode.Null;
}
else if (_mode == 3)
{
newMode = ASHologramManager.SolverMode.Swap;
}
else if (_mode == 4)
{
newMode = ASHologramManager.SolverMode.Scan;
}
_holoManager.SwitchMode(newMode, _handTransform);
_holoManager.UpdateAnimation(active: true, _handTransform);
}
else
{
_holoManager.UpdateAnimation(active: false, null);
}
if (_enabled && (Object)(object)_handTransform != (Object)null)
{
bool gripDown = GetGripDown();
bool gripHeld = GetGripHeld();
bool triggerDown = GetTriggerDown();
Vector2 thumbstickAxis = GetThumbstickAxis();
bool thumbstickClick = GetThumbstickClick();
switch (_mode)
{
case 1:
_telekinesis.Update(_handTransform, gripDown, gripHeld, triggerDown, thumbstickAxis, thumbstickClick);
break;
case 2:
_nullSingularity.Update(_handTransform, gripDown, triggerDown, Time.deltaTime);
break;
case 3:
_coordinateSwap.Update(_handTransform, gripDown, triggerDown);
break;
case 4:
_solutionEye.Update(_handTransform, triggerDown);
break;
}
}
}
private void FindHandTransform()
{
if (!((Object)(object)_handTransform != (Object)null))
{
GameObject val = GameObject.Find(IsLeftHand ? "LeftHand" : "RightHand");
if ((Object)(object)val != (Object)null)
{
_handTransform = val.transform;
}
else if ((Object)(object)Camera.main != (Object)null)
{
_handTransform = ((Component)Camera.main).transform;
}
}
}
private void HandleInput()
{
bool bButtonDown = GetBButtonDown();
if (bButtonDown && !_lastBState)
{
_bClickCount++;
_bPressTimer = 0.4f;
}
if (_bPressTimer > 0f)
{
_bPressTimer -= Time.deltaTime;
if (_bPressTimer <= 0f)
{
if (_bClickCount >= 2)
{
_enabled = !_enabled;
MelonLogger.Msg("[AS] " + (IsLeftHand ? "Left" : "Right") + " hand Solver: " + (_enabled ? "ENABLED" : "DISABLED"));
}
else if (_bClickCount == 1 && _enabled)
{
_mode = _mode % 4 + 1;
MelonLogger.Msg($"[AS] {(IsLeftHand ? "Left" : "Right")} hand Mode changed to: {_mode}");
}
_bClickCount = 0;
}
}
_lastBState = bButtonDown;
}
private bool GetBButtonDown()
{
//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)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(IsLeftHand ? 4 : 5));
bool result = default(bool);
if (((InputDevice)(ref deviceAtXRNode)).isValid && ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.secondaryButton, ref result))
{
return result;
}
return Input.GetKeyDown((KeyCode)(IsLeftHand ? 113 : 101));
}
private bool GetGripDown()
{
//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)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(IsLeftHand ? 4 : 5));
bool result = default(bool);
if (((InputDevice)(ref deviceAtXRNode)).isValid && ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.gripButton, ref result))
{
return result;
}
return Input.GetMouseButtonDown(0);
}
private bool GetGripHeld()
{
//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)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(IsLeftHand ? 4 : 5));
bool result = default(bool);
if (((InputDevice)(ref deviceAtXRNode)).isValid && ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.gripButton, ref result))
{
return result;
}
return Input.GetMouseButton(0);
}
private bool GetTriggerDown()
{
//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)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(IsLeftHand ? 4 : 5));
if (((InputDevice)(ref deviceAtXRNode)).isValid)
{
bool result = default(bool);
if (((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.triggerButton, ref result))
{
return result;
}
float num = default(float);
if (((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.trigger, ref num))
{
return num > 0.5f;
}
}
return Input.GetMouseButtonDown(1);
}
private Vector2 GetThumbstickAxis()
{
//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_002b: Unknown result type (might be due to invalid IL or missing references)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(IsLeftHand ? 4 : 5));
Vector2 result = default(Vector2);
if (((InputDevice)(ref deviceAtXRNode)).isValid && ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.primary2DAxis, ref result))
{
return result;
}
return Vector2.zero;
}
private bool GetThumbstickClick()
{
//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)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(IsLeftHand ? 4 : 5));
bool result = default(bool);
if (((InputDevice)(ref deviceAtXRNode)).isValid && ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.primary2DAxisClick, ref result))
{
return result;
}
return Input.GetKey((KeyCode)32);
}
private void OnDestroy()
{
_holoManager.Cleanup();
_telekinesis?.Cleanup();
_nullSingularity?.Cleanup();
_coordinateSwap?.Cleanup();
_solutionEye?.Cleanup();
}
}
public class ASHologramManager
{
public enum SolverMode
{
Common,
Null,
Swap,
Scan,
Spin
}
private GameObject hologramInstance;
private SpriteRenderer spriteRenderer;
private SolverMode currentMode;
private float animTimer;
private float animDuration = 0.25f;
private static Texture2D texCommon;
private static Texture2D texNull;
private static Texture2D texSwap;
private static Texture2D texScan;
private static Texture2D texSpin;
private static bool texturesLoaded;
public static void LoadTextures()
{
if (!texturesLoaded)
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets");
texCommon = LoadPNG(Path.Combine(path, "SolverCommon.png"));
texNull = LoadPNG(Path.Combine(path, "SolverNull.png"));
texSwap = LoadPNG(Path.Combine(path, "SolverSwap.png"));
texScan = LoadPNG(Path.Combine(path, "SolverScan.png"));
texSpin = LoadPNG(Path.Combine(path, "SolverSpin.png"));
texturesLoaded = true;
}
}
private static Texture2D LoadPNG(string filePath)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
if (File.Exists(filePath))
{
byte[] array = File.ReadAllBytes(filePath);
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
if (ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)))
{
((Texture)val).wrapMode = (TextureWrapMode)1;
return val;
}
}
return null;
}
public void Initialize(Transform handTransform, SolverMode mode)
{
LoadTextures();
currentMode = mode;
CreateHologramObject(handTransform);
animTimer = 0f;
}
private void CreateHologramObject(Transform handTransform)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_007b: 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_00f9: 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_010e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)hologramInstance != (Object)null)
{
Object.Destroy((Object)(object)hologramInstance);
}
hologramInstance = new GameObject("AS_Hologram_" + currentMode);
spriteRenderer = hologramInstance.AddComponent<SpriteRenderer>();
UpdateSprite();
Material val = new Material(Shader.Find("Sprites/Default"));
val.color = new Color(1f, 0.1f, 0.2f, 1f) * 3f;
((Renderer)spriteRenderer).material = val;
if (currentMode == SolverMode.Scan)
{
hologramInstance.transform.SetParent(handTransform, false);
hologramInstance.transform.localPosition = Vector3.zero;
}
else
{
hologramInstance.transform.SetParent(handTransform, false);
hologramInstance.transform.localPosition = new Vector3(0f, 0f, 0.12f);
}
hologramInstance.transform.localScale = Vector3.zero;
}
private void UpdateSprite()
{
//IL_0076: 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)
Texture2D val = null;
switch (currentMode)
{
case SolverMode.Common:
val = texCommon;
break;
case SolverMode.Null:
val = texNull;
break;
case SolverMode.Swap:
val = texSwap;
break;
case SolverMode.Scan:
val = texScan;
break;
case SolverMode.Spin:
val = texSpin ?? texCommon;
break;
}
if ((Object)(object)val != (Object)null)
{
Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
spriteRenderer.sprite = sprite;
}
}
public void SwitchMode(SolverMode newMode, Transform handTransform)
{
if (currentMode != newMode)
{
currentMode = newMode;
CreateHologramObject(handTransform);
}
}
public void UpdateAnimation(bool active, Transform handTransform)
{
//IL_00e4: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
if (!active)
{
if ((Object)(object)hologramInstance != (Object)null)
{
Object.Destroy((Object)(object)hologramInstance);
hologramInstance = null;
}
return;
}
if ((Object)(object)hologramInstance == (Object)null)
{
CreateHologramObject(handTransform);
}
if (animTimer < animDuration)
{
animTimer += Time.deltaTime;
float num = animTimer / animDuration;
float num2 = 1f - Mathf.Pow(1f - num, 3f);
float num3 = Mathf.Lerp(0f, 0.25f, num2);
hologramInstance.transform.localScale = new Vector3(num3, num3, num3);
float num4 = Mathf.Lerp(540f, 45f, num2);
hologramInstance.transform.Rotate(Vector3.forward, num4 * Time.deltaTime);
}
else
{
hologramInstance.transform.Rotate(Vector3.forward, 45f * Time.deltaTime);
}
}
public void Cleanup()
{
if ((Object)(object)hologramInstance != (Object)null)
{
Object.Destroy((Object)(object)hologramInstance);
hologramInstance = null;
}
}
}
public static class ASTargetSelector
{
public const float RangeMeters = 25f;
public const float HalfAngleDegrees = 0.5f;
public static Collider GetTarget(Transform origin)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)origin == (Object)null)
{
return null;
}
Collider result = null;
float num = float.MaxValue;
float num2 = float.MaxValue;
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(origin.position, 25f));
foreach (Collider val in array)
{
if ((Object)(object)val == (Object)null || val.isTrigger || (Object)(object)((Component)val).transform.root == (Object)(object)origin.root)
{
continue;
}
Vector3 val2 = val.ClosestPoint(origin.position) - origin.position;
float magnitude = ((Vector3)(ref val2)).magnitude;
if (!(magnitude > 25f) && !(magnitude < 0.05f))
{
float num3 = Vector3.Angle(origin.forward, val2);
if (num3 <= 0.5f && (num3 < num - 0.01f || (Mathf.Abs(num3 - num) < 0.01f && magnitude < num2)))
{
num = num3;
num2 = magnitude;
result = val;
}
}
}
return result;
}
}
}
namespace ASMod.Modes
{
public class ASCoordinateSwap
{
private Collider lockedTarget;
private bool isSwapping;
private float swapTimer;
private GameObject swapFlashInstance;
public void Update(Transform hand, bool gripDown, bool triggerDown)
{
//IL_0046: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
if (gripDown)
{
lockedTarget = ASTargetSelector.GetTarget(hand);
}
if (triggerDown && (Object)(object)lockedTarget != (Object)null && !isSwapping)
{
isSwapping = true;
swapTimer = 3f;
CreateSwapFlash(((Component)lockedTarget).transform.position);
}
if (!isSwapping)
{
return;
}
swapTimer -= Time.deltaTime;
if ((Object)(object)swapFlashInstance != (Object)null && (Object)(object)Camera.main != (Object)null)
{
Transform transform = ((Component)Camera.main).transform;
swapFlashInstance.transform.LookAt(swapFlashInstance.transform.position + transform.rotation * Vector3.forward, transform.rotation * Vector3.up);
}
if (swapTimer <= 0f)
{
PerformSwap();
isSwapping = false;
if ((Object)(object)swapFlashInstance != (Object)null)
{
Object.Destroy((Object)(object)swapFlashInstance);
}
}
}
private void CreateSwapFlash(Vector3 targetPos)
{
//IL_0030: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
swapFlashInstance = GameObject.CreatePrimitive((PrimitiveType)5);
Object.Destroy((Object)(object)swapFlashInstance.GetComponent<Collider>());
float num = 2.7f;
swapFlashInstance.transform.localScale = new Vector3(num, num, num);
swapFlashInstance.transform.position = targetPos;
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets", "SolverSwap.png");
if (!File.Exists(path))
{
return;
}
byte[] array = File.ReadAllBytes(path);
Texture2D val = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)))
{
MeshRenderer component = swapFlashInstance.GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
Material val2 = new Material(Shader.Find("Sprites/Default"));
val2.mainTexture = (Texture)(object)val;
val2.color = new Color(1f, 0.2f, 0.3f, 1f) * 4f;
((Renderer)component).material = val2;
}
}
}
private void PerformSwap()
{
//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_004b: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)lockedTarget == (Object)null)
{
return;
}
Transform val = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.root : null);
if (!((Object)(object)val == (Object)null))
{
Vector3 position = val.position;
Vector3 position2 = ((Component)lockedTarget).transform.position;
val.position = position2;
((Component)lockedTarget).transform.position = position;
Rigidbody componentInParent = ((Component)lockedTarget).GetComponentInParent<Rigidbody>();
if ((Object)(object)componentInParent != (Object)null)
{
componentInParent.position = position;
}
lockedTarget = null;
}
}
public void Cleanup()
{
lockedTarget = null;
isSwapping = false;
if ((Object)(object)swapFlashInstance != (Object)null)
{
Object.Destroy((Object)(object)swapFlashInstance);
}
}
}
public sealed class ASNullSingularity
{
private GameObject _nullInstance;
private bool _isFired;
private float _lifeTimer;
private Vector3 _position;
private float _currentRadius = 0.6f;
public void Update(Transform hand, bool gripDown, bool triggerDown, float deltaTime)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: 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_00e1: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
if (gripDown && (Object)(object)_nullInstance == (Object)null)
{
_nullInstance = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)_nullInstance).name = "AS_NULL_Singularity";
_nullInstance.transform.position = hand.position + hand.forward * 1.5f;
_nullInstance.transform.localScale = Vector3.one * _currentRadius;
Collider component = _nullInstance.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
component.enabled = false;
}
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets", "NULL.png");
Renderer component2 = _nullInstance.GetComponent<Renderer>();
if ((Object)(object)component2 != (Object)null)
{
Material val = new Material(Shader.Find("Sprites/Default"));
val.color = Color.black;
if (File.Exists(path))
{
byte[] array = File.ReadAllBytes(path);
Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false);
if (ImageConversion.LoadImage(val2, Il2CppStructArray<byte>.op_Implicit(array)))
{
((Texture)val2).wrapMode = (TextureWrapMode)1;
val.mainTexture = (Texture)(object)val2;
val.color = Color.white * 1.5f;
}
}
component2.material = val;
}
_isFired = false;
_lifeTimer = 8f;
}
if (triggerDown && (Object)(object)_nullInstance != (Object)null && !_isFired)
{
_isFired = true;
}
if ((Object)(object)_nullInstance != (Object)null && !_isFired)
{
_position = hand.position + hand.forward * 1.5f;
_nullInstance.transform.position = _position;
}
else
{
if (!_isFired || (Object)(object)_nullInstance == (Object)null)
{
return;
}
_lifeTimer -= deltaTime;
float num = _currentRadius * 3f;
Collider[] array2 = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(_position, num));
HashSet<Rigidbody> hashSet = new HashSet<Rigidbody>();
Collider[] array3 = array2;
foreach (Collider val3 in array3)
{
if ((Object)(object)val3 == (Object)null || ((Object)(object)Camera.main != (Object)null && (Object)(object)((Component)val3).transform.root == (Object)(object)((Component)Camera.main).transform.root))
{
continue;
}
Rigidbody attachedRigidbody = val3.attachedRigidbody;
if (!((Object)(object)attachedRigidbody != (Object)null) || !hashSet.Add(attachedRigidbody))
{
continue;
}
Vector3 val4 = _position - attachedRigidbody.worldCenterOfMass;
float magnitude = ((Vector3)(ref val4)).magnitude;
float num2 = Mathf.Lerp(1200f, 300f, magnitude / num);
attachedRigidbody.AddForce(((Vector3)(ref val4)).normalized * num2, (ForceMode)5);
if (magnitude < _currentRadius * 0.45f)
{
AIBrain componentInParent = ((Component)attachedRigidbody).GetComponentInParent<AIBrain>();
if ((Object)(object)componentInParent != (Object)null)
{
Object.Destroy((Object)(object)((Component)componentInParent).gameObject);
}
else
{
Object.Destroy((Object)(object)((Component)attachedRigidbody).gameObject);
}
}
}
if (_lifeTimer <= 0f)
{
Cleanup();
}
}
}
public void Cleanup()
{
if ((Object)(object)_nullInstance != (Object)null)
{
Object.Destroy((Object)(object)_nullInstance);
}
_nullInstance = null;
_isFired = false;
_lifeTimer = 0f;
}
}
public class ASSolutionEye
{
private float scanTimer;
private bool isScanning;
private Dictionary<Renderer, Material[]> originalMaterials = new Dictionary<Renderer, Material[]>();
public void Update(Transform hand, bool triggerDown)
{
if (triggerDown && !isScanning)
{
StartScan();
}
if (isScanning)
{
scanTimer -= Time.deltaTime;
if (scanTimer <= 0f)
{
EndScan();
}
}
}
private void StartScan()
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
isScanning = true;
scanTimer = 20f;
originalMaterials.Clear();
AIBrain[] array = Il2CppArrayBase<AIBrain>.op_Implicit(Object.FindObjectsOfType<AIBrain>());
foreach (AIBrain val in array)
{
if (!((Object)(object)val != (Object)null) || !((Object)(object)((Component)val).gameObject != (Object)null))
{
continue;
}
Renderer[] array2 = Il2CppArrayBase<Renderer>.op_Implicit(((Component)val).gameObject.GetComponentsInChildren<Renderer>());
foreach (Renderer val2 in array2)
{
if (!((Object)(object)val2 != (Object)null) || originalMaterials.ContainsKey(val2))
{
continue;
}
originalMaterials[val2] = Il2CppArrayBase<Material>.op_Implicit((Il2CppArrayBase<Material>)(object)val2.materials);
foreach (Material item in (Il2CppArrayBase<Material>)(object)val2.materials)
{
if ((Object)(object)item != (Object)null && item.HasProperty("_Color"))
{
item.color = Color.yellow;
}
}
}
}
}
private void EndScan()
{
isScanning = false;
foreach (KeyValuePair<Renderer, Material[]> originalMaterial in originalMaterials)
{
if ((Object)(object)originalMaterial.Key != (Object)null)
{
originalMaterial.Key.materials = Il2CppReferenceArray<Material>.op_Implicit(originalMaterial.Value);
}
}
originalMaterials.Clear();
}
public void Cleanup()
{
EndScan();
}
}
public class ASTelekinesis
{
private Rigidbody heldBody;
private bool isSpinning;
public bool IsSpinning => isSpinning;
public void Update(Transform hand, bool gripDown, bool gripHeld, bool triggerDown, Vector2 stick, bool stickClick)
{
//IL_006a: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: 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_00ca: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
if (gripDown)
{
Collider target = ASTargetSelector.GetTarget(hand);
if ((Object)(object)target != (Object)null)
{
heldBody = ((Component)target).GetComponentInParent<Rigidbody>();
}
}
if (gripHeld && (Object)(object)heldBody != (Object)null)
{
if (stickClick)
{
isSpinning = true;
heldBody.AddTorque(hand.forward * 5000f, (ForceMode)5);
}
else
{
isSpinning = false;
Vector3 val = (hand.position + hand.forward * 2f + Vector3.up * (stick.y * 0.5f) - heldBody.position) * 50f - heldBody.velocity * 5f;
heldBody.AddForce(val, (ForceMode)5);
}
}
else if (!gripHeld && (Object)(object)heldBody != (Object)null)
{
if (isSpinning)
{
heldBody.AddForce(hand.forward * 15000f, (ForceMode)0);
}
heldBody = null;
isSpinning = false;
}
if (!triggerDown)
{
return;
}
Collider target2 = ASTargetSelector.GetTarget(hand);
if ((Object)(object)target2 != (Object)null)
{
AIBrain componentInParent = ((Component)target2).GetComponentInParent<AIBrain>();
if ((Object)(object)componentInParent != (Object)null && (Object)(object)((Component)componentInParent).gameObject != (Object)null)
{
Object.Destroy((Object)(object)((Component)componentInParent).gameObject);
}
else
{
Object.Destroy((Object)(object)((Component)target2).gameObject);
}
}
}
public void Cleanup()
{
heldBody = null;
isSpinning = false;
}
}
}