Decompiled source of Hologram v1.2.6

Mods/Hologram.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Hologram;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "Hologram", "1.2.3", "ERROR", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonAuthorColor(255, 255, 0, 0)]
[assembly: AssemblyTitle("Hologram")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hologram")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b10c94a1-8a40-4701-bc5b-98eabb44dfea")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Hologram;

public class main : MelonMod
{
	private bool init = false;

	private bool setPos = false;

	private string currentScene = "Loader";

	private int sceneCount = 0;

	private bool sceneChanged = false;

	private List<GameObject> cubeGrid = new List<GameObject>();

	private Vector3[] noisePositions = (Vector3[])(object)new Vector3[900];

	private float time;

	public List<Vector3[]> ModelsList = new List<Vector3[]>();

	private GameObject materialHolder;

	private GameObject player;

	private Transform RhandTransform;

	private Transform LhandTransform;

	private Vector3 RprevHandPosition;

	private Vector3 LprevHandPosition;

	private Vector3 RhandVelocity;

	private Vector3 LhandVelocity;

	private Vector3 cubeParentVelocity = Vector3.zero;

	private float rotationVelocity;

	private GameObject RhandCube;

	private GameObject LhandCube;

	private UI UI = UI.instance;

	private Mod Hologram = new Mod();

	private string FILEPATH = "UserData\\Hologram";

	private GameObject MainParent;

	private int CurrentModel = 0;

	private int CurrentShape = 1;

	private int waitedTicks = 0;

	public GameObject cubeParent;

	private bool isAdjustingCubeCount = false;

	public override void OnLateInitializeMelon()
	{
		//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_0066: Expected O, but got Unknown
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Expected O, but got Unknown
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		MelonLogger.Msg("Hologram Initiated");
		Hologram.ModName = "Hologram";
		Hologram.ModVersion = "1.2.3";
		Hologram.SetFolder("Hologram");
		Hologram.AddDescription("Description", "Description", "Shows a Hologram in Gym", new Tags
		{
			IsSummary = true
		});
		Hologram.AddToList("Follow Hands (Move)", false, 0, "Toggles if the hologram follows your hands in order to move it around", new Tags());
		Hologram.AddToList("Toggle Hologram", true, 0, "Toggles if the hologram should be enabled or not", new Tags());
		Hologram.GetFromFile();
		Hologram.ModSaved += Save;
		UI.instance.UI_Initialized += UIInit;
		Calls.onMapInitialized += OnMapInitialized;
	}

	public void UIInit()
	{
		UI.AddMod(Hologram);
	}

	public void Save()
	{
		if (currentScene == "Gym" || currentScene == "Park")
		{
			MainParent.SetActive((bool)Hologram.Settings[2].SavedValue);
		}
	}

	public void OnMapInitialized()
	{
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		if (currentScene == "Gym" || currentScene == "Park")
		{
			if (!init)
			{
				MelonCoroutines.Start(InitializeWithPause(sceneCount));
				return;
			}
			MainParent.SetActive((bool)Hologram.Settings[2].SavedValue);
			if ((Object)(object)LhandTransform == (Object)null || (Object)(object)RhandTransform == (Object)null)
			{
				player = ((Component)((Component)Players.GetLocalPlayer().Controller).gameObject.transform.GetChild(1)).gameObject;
				RhandTransform = player.transform.GetChild(2);
				LhandTransform = player.transform.GetChild(1);
			}
			MainParent.transform.position = ((currentScene == "Gym") ? new Vector3(3.92f, 1.2909f, -3.1745f) : new Vector3(-26.3655f, -4.4727f, 9.1037f));
		}
		else if (init)
		{
			MainParent.SetActive(false);
		}
		else
		{
			MelonLogger.Error("What the fuck did you do");
		}
	}

	private IEnumerator InitializeWithPause(int sceneNumber)
	{
		DateTime targetTime = DateTime.Now.AddSeconds(1.0);
		while (DateTime.Now < targetTime)
		{
			yield return (object)new WaitForFixedUpdate();
		}
		if (sceneNumber == sceneCount)
		{
			Initialize();
		}
	}

	private void Initialize()
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		ModelsList = new List<Vector3[]>();
		int num = 25;
		float num2 = 1f;
		float num3 = num2 / (float)num;
		float num4 = (float)(num - 1) * num3 / 2f;
		noisePositions = (Vector3[])(object)new Vector3[num * num];
		int num5 = 0;
		for (int i = 0; i < num; i++)
		{
			for (int j = 0; j < num; j++)
			{
				noisePositions[num5] = new Vector3((float)i * num3 - num4, 0f, (float)j * num3 - num4);
				num5++;
			}
		}
		InitializeModels();
		InitializePlayer();
		InitializeCubeGrid();
		InitializeHandColliders();
		MainParent.SetActive((bool)Hologram.Settings[2].SavedValue);
		init = true;
	}

	public static string[] ReadFileText(string filePath, string fileName)
	{
		try
		{
			return File.ReadAllLines(filePath + "\\" + fileName);
		}
		catch (Exception ex)
		{
			MelonLogger.Error((object)ex);
		}
		return null;
	}

	public static Vector3 ParseStringToVector3(string vectorString)
	{
		//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_003a: Unknown result type (might be due to invalid IL or missing references)
		string[] array = vectorString.Split(new char[1] { ',' });
		float num = float.Parse(array[0]);
		float num2 = float.Parse(array[1]);
		float num3 = float.Parse(array[2]);
		return new Vector3(num, num2, num3);
	}

	private void InitializeModels()
	{
		//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_0050: Unknown result type (might be due to invalid IL or missing references)
		string[] files = Directory.GetFiles(FILEPATH, "*.obj");
		string[] array = files;
		foreach (string filePath in array)
		{
			string[] array2 = Load3DModel(filePath).ToArray();
			List<Vector3> list = new List<Vector3>();
			string[] array3 = array2;
			foreach (string vectorString in array3)
			{
				Vector3 item = ParseStringToVector3(vectorString);
				list.Add(item);
			}
			ModelsList.Add(list.ToArray());
		}
	}

	private List<string> Load3DModel(string filePath)
	{
		if (!File.Exists(filePath))
		{
			MelonLogger.Error("File Not found: " + filePath);
			return new List<string>();
		}
		List<string> list = new List<string>();
		string[] array = File.ReadAllLines(filePath);
		string[] array2 = array;
		foreach (string text in array2)
		{
			string[] array3 = text.Trim().Split();
			if (array3[0] == "v")
			{
				list.Add(array3[1] + ", " + array3[2] + ", " + array3[3]);
			}
		}
		return list;
	}

	private void InitializePlayer()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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: Expected O, but got Unknown
		//IL_00a0: 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)
		player = ((Component)((Component)Players.GetLocalPlayer().Controller).gameObject.transform.GetChild(1)).gameObject;
		RhandTransform = player.transform.GetChild(2);
		LhandTransform = player.transform.GetChild(1);
		RprevHandPosition = RhandTransform.position;
		LprevHandPosition = LhandTransform.position;
		MainParent = new GameObject("Hologram Stuff");
		MainParent.transform.position = new Vector3(3.92f, 1.2909f, -3.1745f);
		MainParent.transform.rotation = Quaternion.Euler(0f, 18.7272f, 0f);
		Object.DontDestroyOnLoad((Object)(object)MainParent);
	}

	private void InitializeHandColliders()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		GameObject val = new GameObject("Hand Colliders");
		RhandCube = CreateHandCollider("Right Hand Collider", val.transform);
		LhandCube = CreateHandCollider("Left Hand Collider", val.transform);
		Object.DontDestroyOnLoad((Object)(object)val);
	}

	private GameObject CreateHandCollider(string name, Transform parent)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
		val.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
		((Object)val).name = name;
		val.transform.parent = parent;
		Renderer component = val.GetComponent<Renderer>();
		component.material = ((Renderer)materialHolder.GetComponent<MeshRenderer>()).material;
		component.enabled = false;
		Rigidbody val2 = val.AddComponent<Rigidbody>();
		val2.isKinematic = true;
		val.AddComponent<BoxCollider>();
		return val;
	}

	private void InitializeCubeGrid()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		cubeParent = new GameObject("CubeGridParent");
		cubeParent.transform.parent = MainParent.transform;
		Material material = ((Component)((Component)Gym.GetGymPoseGhostHandler().poseGhost).transform.GetChild(0).GetChild(1)).GetComponent<Renderer>().material;
		materialHolder = new GameObject("Pose Ghost Material");
		MeshRenderer val = materialHolder.AddComponent<MeshRenderer>();
		((Renderer)val).material = material;
		Object.DontDestroyOnLoad((Object)(object)materialHolder);
		materialHolder.transform.parent = MainParent.transform;
		CreateCubeGrid(ModelsList[0], material);
		cubeParent.transform.position = Vector3.zero;
		cubeParent.transform.rotation = Quaternion.Euler(0f, 26.3635f, 0f);
		cubeParent.transform.localPosition = new Vector3(-0.2072f, -0.0909f, -0.3345f);
		cubeParent.transform.localScale = Vector3.one;
		InitializeButtons(material);
	}

	private void InitializeButtons(Material material)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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_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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: 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)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: 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)
		GameObject val = Create.NewButton(Vector3.zero, Quaternion.identity, (Action)delegate
		{
			if (!isAdjustingCubeCount)
			{
				CurrentModel = (CurrentModel + 1) % (ModelsList.Count + 1);
				AdjustCubeCountSwitch(material);
			}
		});
		((Object)val).name = "Next Model Button";
		val.transform.parent = MainParent.transform;
		val.transform.localRotation = Quaternion.Euler(270.9994f, 52.2065f, 179.9999f);
		val.transform.localPosition = new Vector3(-3.2719f, 0.0073f, -1.9171f);
		GameObject val2 = Create.NewText("→", 1f, Color.white, val.transform.position, Quaternion.identity);
		((Object)val2).name = "Next Model Text";
		val2.transform.parent = val.transform;
		val2.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
		val2.transform.localPosition = new Vector3(0.0077f, 0.0898f, 0.0205f);
		GameObject val3 = Create.NewButton(Vector3.zero, Quaternion.identity, (Action)delegate
		{
			if (!isAdjustingCubeCount)
			{
				CurrentModel = (CurrentModel + ModelsList.Count) % (ModelsList.Count + 1);
				AdjustCubeCountSwitch(material);
			}
		});
		((Object)val3).name = "Prev Model Button";
		val3.transform.parent = MainParent.transform;
		val3.transform.localRotation = Quaternion.Euler(270.9994f, 52.2065f, 179.9999f);
		val3.transform.localPosition = new Vector3(-3.1225f, 0.0073f, -2.1199f);
		GameObject val4 = Create.NewText("←", 1f, Color.white, val.transform.position, Quaternion.identity);
		((Object)val4).name = "Prev Model Text";
		val4.transform.parent = val3.transform;
		val4.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
		val4.transform.localPosition = new Vector3(0.0077f, 0.0898f, 0.0205f);
	}

	private void AdjustCubeCountSwitch(Material material)
	{
		if (CurrentModel >= 0 && CurrentModel < ModelsList.Count)
		{
			AdjustCubeCount(ModelsList[CurrentModel], material);
		}
		else if (CurrentModel >= 0 && CurrentModel == ModelsList.Count)
		{
			AdjustCubeCount(noisePositions, material);
		}
	}

	private void CreateCubeGrid(Vector3[] model, Material material)
	{
		//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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		PrimitiveType val = (PrimitiveType)(CurrentShape switch
		{
			0 => 3, 
			1 => 0, 
			_ => 3, 
		});
		foreach (Vector3 localPosition in model)
		{
			GameObject val2 = GameObject.CreatePrimitive(val);
			val2.transform.localPosition = localPosition;
			val2.transform.parent = cubeParent.transform;
			float num = 0.03f;
			val2.transform.localScale = new Vector3(num, num, num);
			Renderer component = val2.GetComponent<Renderer>();
			component.material = ((Renderer)materialHolder.GetComponent<MeshRenderer>()).material;
			Rigidbody val3 = val2.AddComponent<Rigidbody>();
			val3.isKinematic = true;
			cubeGrid.Add(val2);
		}
	}

	public void AdjustCubeCount(Vector3[] model, Material material)
	{
		if (!isAdjustingCubeCount)
		{
			isAdjustingCubeCount = true;
			MelonCoroutines.Start(AdjustCubeCountCoroutine(model, material));
		}
	}

	private IEnumerator AdjustCubeCountCoroutine(Vector3[] model, Material material)
	{
		int currentCount = cubeGrid.Count;
		int targetCount = model.Length;
		float waitTime = 1.5f / (float)Mathf.Abs(targetCount - currentCount);
		PrimitiveType shapeType = (PrimitiveType)(CurrentShape switch
		{
			0 => 3, 
			1 => 0, 
			_ => 3, 
		});
		if (currentCount < targetCount)
		{
			for (int j = currentCount; j < targetCount; j++)
			{
				if (!(currentScene == "Gym") && !(currentScene == "Park"))
				{
					break;
				}
				GameObject cube2 = GameObject.CreatePrimitive(shapeType);
				cube2.transform.localPosition = RhandTransform.position;
				cube2.transform.parent = cubeParent.transform;
				cube2.transform.localScale = new Vector3(0.03f, 0.03f, 0.03f);
				Renderer renderer = cube2.GetComponent<Renderer>();
				renderer.material = ((Renderer)materialHolder.GetComponent<MeshRenderer>()).material;
				Rigidbody rb = cube2.AddComponent<Rigidbody>();
				rb.isKinematic = true;
				cubeGrid.Add(cube2);
				yield return (object)new WaitForSeconds(waitTime);
			}
		}
		else if (currentCount > targetCount)
		{
			for (int i = currentCount - 1; i >= targetCount; i--)
			{
				GameObject cube = cubeGrid[i];
				cubeGrid.Remove(cube);
				Object.Destroy((Object)(object)cube);
			}
		}
		isAdjustingCubeCount = false;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		sceneChanged = true;
	}

	public override void OnUpdate()
	{
		if (init && (bool)Hologram.Settings[2].SavedValue && (currentScene == "Gym" || currentScene == "Park"))
		{
			if ((Object)(object)LhandCube != (Object)null && (Object)(object)RhandCube != (Object)null && (Object)(object)RhandTransform != (Object)null && (Object)(object)LhandTransform != (Object)null)
			{
				UpdateHandPositions();
				UpdateCubeGrid();
			}
			if (CurrentModel == ModelsList.Count)
			{
				UpdateNoisePositions();
			}
		}
	}

	private void UpdateHandPositions()
	{
		//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_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_006e: 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_009c: 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_00ca: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: 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_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		time += Time.deltaTime;
		Vector3 position = RhandTransform.position;
		Vector3 position2 = LhandTransform.position;
		bool flag = RightController.GetGrip() > 0.9f && RightController.GetTrigger() > 0.9f;
		bool flag2 = LeftController.GetGrip() > 0.9f && LeftController.GetTrigger() > 0.9f;
		RhandCube.transform.position = position;
		RhandCube.transform.rotation = RhandTransform.rotation;
		LhandCube.transform.position = position2;
		LhandCube.transform.rotation = LhandTransform.rotation;
		if (Vector3.Distance(player.transform.position, MainParent.transform.position) <= 4f)
		{
			if (RightController.GetGrip() > 0.9f && !flag)
			{
				RhandVelocity = (position - RprevHandPosition) / Time.deltaTime;
				rotationVelocity += RhandVelocity.x * 50f;
			}
			if (LeftController.GetGrip() > 0.9f && !flag2)
			{
				LhandVelocity = (position2 - LprevHandPosition) / Time.deltaTime;
				rotationVelocity += LhandVelocity.x * 50f;
			}
		}
		RprevHandPosition = position;
		LprevHandPosition = position2;
		rotationVelocity *= 0.95f;
		float num = 100f;
		rotationVelocity = Mathf.Clamp(rotationVelocity, 0f - num, num);
		cubeParent.transform.Rotate(Vector3.up, rotationVelocity * Time.deltaTime);
	}

	private void UpdateCubeGrid()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		for (int num = cubeGrid.Count - 1; num >= 0; num--)
		{
			GameObject val = cubeGrid[num];
			if ((Object)(object)val != (Object)null)
			{
				float num2 = Mathf.Sin(time + (float)num) * 0.005f;
				Vector3 targetPosition = GetTargetPosition(num);
				targetPosition.y += num2;
				Rigidbody component = val.GetComponent<Rigidbody>();
				HandleCollisionAndLerp(val, component, targetPosition);
			}
		}
	}

	private void UpdateNoisePositions()
	{
		//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_0013: 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_0059: 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)
		for (int i = 0; i < noisePositions.Length; i++)
		{
			Vector3 val = noisePositions[i];
			float x = val.x;
			float num = val.z + time * 0.07f;
			float y = Mathf.PerlinNoise(x / 0.2f, num / 0.2f) * 0.2f;
			val.y = y;
			noisePositions[i] = val;
		}
	}

	private Vector3 GetTargetPosition(int index)
	{
		//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)
		//IL_007a: 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_006a: 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 (CurrentModel >= 0 && CurrentModel < ModelsList.Count)
		{
			return ModelsList[CurrentModel][index];
		}
		if (CurrentModel >= 0 && CurrentModel == ModelsList.Count)
		{
			return noisePositions[index];
		}
		return Vector3.zero;
	}

	private void HandleCollisionAndLerp(GameObject cube, Rigidbody rb, Vector3 targetPosition)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: 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_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: 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_0259: Unknown result type (might be due to invalid IL or missing references)
		rb.useGravity = false;
		rb.drag = 1f;
		rb.angularDrag = 1f;
		Collider component = cube.GetComponent<Collider>();
		Collider component2 = RhandCube.GetComponent<Collider>();
		Collider component3 = LhandCube.GetComponent<Collider>();
		bool flag = false;
		Bounds bounds = component.bounds;
		Vector3 val;
		if (((Bounds)(ref bounds)).Intersects(component2.bounds) && RightController.GetGrip() > 0.9f && RightController.GetTrigger() > 0.9f && Vector3.Distance(player.transform.position, MainParent.transform.position) <= 4f)
		{
			val = cube.transform.position - RhandCube.transform.position;
			ApplyForce(cube, rb, ((Vector3)(ref val)).normalized);
			flag = false;
		}
		else
		{
			bounds = component.bounds;
			if (((Bounds)(ref bounds)).Intersects(component3.bounds) && LeftController.GetGrip() > 0.9f && LeftController.GetTrigger() > 0.9f && Vector3.Distance(player.transform.position, MainParent.transform.position) <= 4f)
			{
				val = cube.transform.position - LhandCube.transform.position;
				ApplyForce(cube, rb, ((Vector3)(ref val)).normalized);
				flag = false;
			}
			else
			{
				val = rb.velocity;
				if (((Vector3)(ref val)).magnitude < 0.01f)
				{
					rb.isKinematic = true;
					flag = true;
				}
			}
		}
		if (flag)
		{
			cube.transform.localPosition = Vector3.Lerp(cube.transform.localPosition, targetPosition, Time.deltaTime);
		}
		if ((bool)Hologram.Settings[1].SavedValue)
		{
			cubeParent.transform.position = RhandTransform.position;
			cubeParent.transform.rotation = Quaternion.Euler(cubeParent.transform.rotation.x, RhandTransform.rotation.y, cubeParent.transform.rotation.z);
		}
	}

	private void ApplyForce(GameObject cube, Rigidbody rb, Vector3 direction)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		rb.isKinematic = false;
		rb.AddForce(direction * 5f, (ForceMode)5);
	}
}