Decompiled source of GorillaTag v1.0.0

Mods/GorillaTag.dll

Decompiled 14 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using GorillaTag;
using Il2CppExitGames.Client.Photon;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppPhoton.Pun;
using Il2CppPhoton.Realtime;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using RumbleModdingAPI.RMAPI;
using UnityEngine;
using UnityEngine.XR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(GorillaProgram), "GorillaTag", "1.0.0", "DefinitelyNotEnder", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("GorillaTag")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GorillaTag")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("F3A9C7E2-4B81-4D6A-9E05-7C2A1B8F3D64")]
[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 GorillaTag;

public class GorillaProgram : MelonMod
{
	private string currentScene = "Loader";

	private bool isActive;

	private bool hasRefs;

	private const string GTModKey = "GTMod";

	private const string GTActiveKey = "GTActive";

	private readonly ButtonState leftSecondaryState = new ButtonState();

	private readonly ButtonState rightSecondaryState = new ButtonState();

	private bool wasBothSecondariesPressed;

	private const float ToggleTimeout = 1f;

	private int toggleCount;

	private float toggleTimer;

	private GameObject playerGo;

	private PlayerManager playerManager;

	private Rigidbody playerRb;

	private Transform playerVROrigin;

	private Transform playerHead;

	private PlayerResetSystem resetSystem;

	private GorillaTagLocomotion locomotion;

	private const string OwnSentinelName = "LocoActive_Gorilla";

	private static readonly string[] OtherSentinelNames = new string[2] { "LocoActive_Moon", "LocoActive_Rock" };

	private GameObject sentinel;

	private readonly List<Collider> disabledColliders = new List<Collider>();

	private static readonly string[] HipBonePaths = new string[2] { "Visuals/Skelington/Bone_Pelvis/Bone_Hip_R", "Visuals/Skelington/Bone_Pelvis/Bone_Hip_L" };

	private readonly Dictionary<string, Vector3> defaultHipScales = new Dictionary<string, Vector3>();

	private readonly Dictionary<int, bool> remoteLegsHidden = new Dictionary<int, bool>();

	private bool localLegsHidden;

	private float reconcileTimer;

	private const float ReconcileInterval = 0.25f;

	private bool gtModBroadcast;

	private static readonly string[] DisableColliderLayerNames = new string[4] { "PlayerController", "PlayerFeet", "PlayerPhysicsTransform", "PlayerPhysicsBone" };

	private static readonly string[] GroundLayerNames = new string[6] { "Floor", "CombatFloor", "Environment", "Leanable", "PedestalFloor", "Move" };

	private const float GroundProbeRadius = 0.3f;

	private const float StandClearance = 1.5f;

	private const float MaxSettleHeight = 2f;

	private const float MaxBumpSpeed = 8f;

	private static bool OtherLocomotionActive()
	{
		string[] otherSentinelNames = OtherSentinelNames;
		for (int i = 0; i < otherSentinelNames.Length; i++)
		{
			if ((Object)(object)GameObject.Find(otherSentinelNames[i]) != (Object)null)
			{
				return true;
			}
		}
		return false;
	}

	private bool IsAllowed(out bool resolvable)
	{
		resolvable = true;
		try
		{
			if (currentScene == "Gym")
			{
				return true;
			}
			if (currentScene != "Park")
			{
				return false;
			}
			if (Players.IsHost())
			{
				return true;
			}
			Player masterClient = PhotonNetwork.MasterClient;
			if (masterClient == null)
			{
				resolvable = false;
				return false;
			}
			if (NetProps.Has(masterClient, "GTMod"))
			{
				return true;
			}
			return false;
		}
		catch
		{
			resolvable = false;
			return false;
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		playerGo = null;
		hasRefs = false;
		gtModBroadcast = false;
		remoteLegsHidden.Clear();
		localLegsHidden = false;
		if (isActive)
		{
			CleanupMod();
		}
	}

	private void GetPlayerReferences()
	{
		try
		{
			if (!((Object)(object)playerGo != (Object)null))
			{
				playerManager = Singleton<PlayerManager>.instance;
				playerGo = ((Component)playerManager.localPlayer.Controller).gameObject;
				resetSystem = playerGo.GetComponentInChildren<PlayerResetSystem>();
				playerVROrigin = playerGo.transform.Find("VR");
				playerRb = ((Component)playerVROrigin).GetComponent<Rigidbody>();
				playerHead = playerGo.transform.Find("VR/Headset Offset/Headset");
				hasRefs = true;
			}
		}
		catch
		{
		}
	}

	private void DisableInterferingColliders()
	{
		disabledColliders.Clear();
		if ((Object)(object)playerGo == (Object)null)
		{
			return;
		}
		HashSet<int> hashSet = new HashSet<int>();
		string[] disableColliderLayerNames = DisableColliderLayerNames;
		for (int i = 0; i < disableColliderLayerNames.Length; i++)
		{
			int num = LayerMask.NameToLayer(disableColliderLayerNames[i]);
			if (num >= 0)
			{
				hashSet.Add(num);
			}
		}
		foreach (Collider componentsInChild in playerGo.GetComponentsInChildren<Collider>(true))
		{
			if (!((Object)(object)componentsInChild == (Object)null) && componentsInChild.enabled && !componentsInChild.isTrigger && hashSet.Contains(((Component)componentsInChild).gameObject.layer))
			{
				componentsInChild.enabled = false;
				disabledColliders.Add(componentsInChild);
			}
		}
		MelonLogger.Msg($"Disabled {disabledColliders.Count} player body colliders for Gorilla locomotion.");
	}

	private void RestoreColliders()
	{
		foreach (Collider disabledCollider in disabledColliders)
		{
			if ((Object)(object)disabledCollider != (Object)null)
			{
				disabledCollider.enabled = true;
			}
		}
		disabledColliders.Clear();
	}

	private Transform FindFeet()
	{
		if ((Object)(object)playerGo == (Object)null)
		{
			return null;
		}
		return playerGo.transform.Find("VR/Foot Collider");
	}

	private bool FindGroundY(Vector3 feetPos, out float groundY)
	{
		//IL_0014: 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_0026: 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_0032: 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_004c: 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)
		groundY = float.NegativeInfinity;
		bool result = false;
		int mask = LayerMask.GetMask(GroundLayerNames);
		Vector3 val = new Vector3(feetPos.x, feetPos.y + 2.5f, feetPos.z);
		RaycastHit val2 = default(RaycastHit);
		if (Physics.Raycast(val, Vector3.down, ref val2, 12f, mask, (QueryTriggerInteraction)1))
		{
			groundY = Mathf.Max(groundY, ((RaycastHit)(ref val2)).point.y);
			result = true;
		}
		RaycastHit val3 = default(RaycastHit);
		if (Physics.SphereCast(val, 0.3f, Vector3.down, ref val3, 12f, mask, (QueryTriggerInteraction)1))
		{
			groundY = Mathf.Max(groundY, ((RaycastHit)(ref val3)).point.y);
			result = true;
		}
		return result;
	}

	private void SettleOntoGround()
	{
		//IL_002f: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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)
		if ((Object)(object)playerVROrigin == (Object)null || (Object)(object)playerRb == (Object)null)
		{
			return;
		}
		Transform val = FindFeet();
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		float y = val.position.y;
		if (!FindGroundY(val.position, out var groundY))
		{
			return;
		}
		float num = y - groundY;
		if (!(num > 2f))
		{
			if (num < 1.5f)
			{
				float num2 = 1.5f - num;
				float num3 = Mathf.Min(Mathf.Sqrt(19.62f * num2), 8f);
				playerRb.velocity = new Vector3(0f, num3, 0f);
			}
			else
			{
				Transform obj = playerVROrigin;
				obj.position += Vector3.down * (num - 1.5f);
				playerRb.velocity = Vector3.zero;
			}
		}
	}

	private void ApplyLegs(PlayerController controller, bool hide)
	{
		//IL_0082: 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_005d: 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 ((Object)(object)controller == (Object)null)
		{
			return;
		}
		Transform transform = ((Component)controller).gameObject.transform;
		string[] hipBonePaths = HipBonePaths;
		foreach (string text in hipBonePaths)
		{
			Transform val = transform.Find(text);
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			if (hide)
			{
				if (!defaultHipScales.ContainsKey(text))
				{
					defaultHipScales[text] = val.localScale;
				}
				val.localScale = Vector3.zero;
			}
			else
			{
				val.localScale = (defaultHipScales.TryGetValue(text, out var value) ? value : Vector3.one);
			}
		}
	}

	private void UpdateLocalLegs()
	{
		if (localLegsHidden != isActive)
		{
			PlayerController localPlayerController = Players.GetLocalPlayerController();
			if (!((Object)(object)localPlayerController == (Object)null))
			{
				ApplyLegs(localPlayerController, isActive);
				localLegsHidden = isActive;
			}
		}
	}

	private void ReconcileRemoteLegs()
	{
		if (!NetProps.InRoom)
		{
			return;
		}
		Player[] playerList = NetProps.PlayerList;
		if (playerList == null)
		{
			return;
		}
		Player[] array = playerList;
		foreach (Player val in array)
		{
			if (val == null || val.IsLocal)
			{
				continue;
			}
			int actorNumber = val.ActorNumber;
			bool flag = NetProps.Get(val, "GTActive") == "1";
			bool value;
			bool flag2 = remoteLegsHidden.TryGetValue(actorNumber, out value) && value;
			if (flag != flag2)
			{
				Player playerByActorNo = Players.GetPlayerByActorNo(actorNumber);
				PlayerController val2 = ((playerByActorNo != null) ? playerByActorNo.Controller : null);
				if (!((Object)(object)val2 == (Object)null))
				{
					ApplyLegs(val2, flag);
					remoteLegsHidden[actorNumber] = flag;
				}
			}
		}
	}

	private void BroadcastModPresence()
	{
		if (!gtModBroadcast && NetProps.InRoom)
		{
			NetProps.SetLocal("GTMod", "1");
			gtModBroadcast = true;
		}
	}

	private void SetupMod()
	{
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Expected O, but got Unknown
		if (!IsAllowed(out var _))
		{
			return;
		}
		if (currentScene != "Gym" && currentScene != "Park")
		{
			MelonLogger.Msg("Unable to enable Gorilla Locomotion - not in a valid scene.");
			return;
		}
		MelonLogger.Msg("Enabling Gorilla Locomotion...");
		GetPlayerReferences();
		if (hasRefs)
		{
			if (locomotion == null)
			{
				locomotion = new GorillaTagLocomotion(playerRb, playerVROrigin, playerHead);
			}
			else
			{
				locomotion.ResetState();
			}
			DisableInterferingColliders();
			resetSystem.useAirborneReset = false;
			resetSystem.useSceneBoundariesReset = false;
			if ((Object)(object)sentinel == (Object)null)
			{
				sentinel = new GameObject("LocoActive_Gorilla");
			}
			isActive = true;
			NetProps.SetLocal("GTActive", "1");
		}
	}

	private void CleanupMod()
	{
		try
		{
			MelonLogger.Msg("Disabling Gorilla Locomotion...");
			GetPlayerReferences();
			RestoreColliders();
			SettleOntoGround();
			NetProps.SetLocal("GTActive", "0");
			isActive = false;
			if (hasRefs)
			{
				if ((Object)(object)sentinel != (Object)null)
				{
					Object.Destroy((Object)(object)sentinel);
					sentinel = null;
				}
				if (!OtherLocomotionActive())
				{
					resetSystem.useAirborneReset = true;
					resetSystem.useSceneBoundariesReset = true;
				}
				locomotion = null;
			}
		}
		catch
		{
			MelonLogger.Msg("Unable to disable mod.");
		}
	}

	private void HandleGestures()
	{
		leftSecondaryState.UpdateState(LeftController.GetSecondary() > 0.5f);
		rightSecondaryState.UpdateState(RightController.GetSecondary() > 0.5f);
		bool flag = leftSecondaryState.IsPressed && rightSecondaryState.IsPressed;
		bool num = flag && !wasBothSecondariesPressed;
		wasBothSecondariesPressed = flag;
		if (num)
		{
			if (toggleCount == 0)
			{
				toggleTimer = 0f;
			}
			toggleCount++;
		}
		if (toggleCount > 0)
		{
			toggleTimer += Time.deltaTime;
			if (toggleTimer > 1f)
			{
				toggleCount = 0;
				toggleTimer = 0f;
			}
		}
		if (toggleCount >= 2)
		{
			toggleCount = 0;
			toggleTimer = 0f;
			if (isActive)
			{
				CleanupMod();
			}
			else
			{
				SetupMod();
			}
		}
	}

	public override void OnUpdate()
	{
		BroadcastModPresence();
		UpdateLocalLegs();
		reconcileTimer += Time.deltaTime;
		if (reconcileTimer >= 0.25f)
		{
			reconcileTimer = 0f;
			try
			{
				ReconcileRemoteLegs();
			}
			catch
			{
			}
		}
		try
		{
			HandleGestures();
		}
		catch
		{
		}
		if (isActive)
		{
			if ((Object)(object)resetSystem != (Object)null)
			{
				resetSystem.useAirborneReset = false;
				resetSystem.useSceneBoundariesReset = false;
			}
			locomotion?.Tick();
		}
	}
}
public class GorillaTagLocomotion
{
	private const float MaxArmLength = 1.5f;

	private const float UnStickDistance = 1f;

	private const float VelocityLimit = 0.4f;

	private const float MaxJumpSpeed = 6.5f;

	private const float JumpMultiplier = 1.1f;

	private const float MinimumRaycastDistance = 0.05f;

	private const float DefaultSlideFactor = 0.03f;

	private const float DefaultPrecision = 0.995f;

	private const float HeadRadius = 0.2f;

	private const int VelocityHistorySize = 8;

	private static readonly bool EnableHaptics;

	private const float TouchHapticAmplitude = 0.45f;

	private const float TouchHapticDuration = 0.06f;

	private readonly LayerMask locomotionEnabledLayers;

	private readonly Rigidbody playerRigidBody;

	private readonly Transform bodyTransform;

	private readonly Transform head;

	private readonly Transform leftHandTransform;

	private readonly Transform rightHandTransform;

	private Vector3 lastLeftHandPosition;

	private Vector3 lastRightHandPosition;

	private Vector3 lastHeadPosition;

	private readonly Vector3[] velocityHistory;

	private int velocityIndex;

	private Vector3 currentVelocity;

	private Vector3 denormalizedVelocityAverage;

	private Vector3 lastPosition;

	private bool wasLeftHandTouching;

	private bool wasRightHandTouching;

	public bool disableMovement;

	public bool IsTouching
	{
		get
		{
			if (!wasLeftHandTouching)
			{
				return wasRightHandTouching;
			}
			return true;
		}
	}

	public GorillaTagLocomotion(Rigidbody rb, Transform vrOrigin, Transform headTransform)
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		playerRigidBody = rb;
		bodyTransform = vrOrigin;
		head = headTransform;
		GameObject gameObject = ((Component)Players.GetLocalPlayerController()).gameObject;
		leftHandTransform = gameObject.transform.Find("VR/Left Controller/IkTarget");
		rightHandTransform = gameObject.transform.Find("VR/Right Controller/IkTarget");
		locomotionEnabledLayers = LayerMask.op_Implicit(LayerMask.GetMask(new string[6] { "Floor", "CombatFloor", "Environment", "Leanable", "PedestalFloor", "Move" }));
		velocityHistory = (Vector3[])(object)new Vector3[8];
		ResetState();
	}

	public void ResetState()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0050: 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_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_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)
		if (Object.op_Implicit((Object)(object)leftHandTransform))
		{
			lastLeftHandPosition = leftHandTransform.position;
		}
		if (Object.op_Implicit((Object)(object)rightHandTransform))
		{
			lastRightHandPosition = rightHandTransform.position;
		}
		if (Object.op_Implicit((Object)(object)head))
		{
			lastHeadPosition = head.position;
		}
		velocityIndex = 0;
		denormalizedVelocityAverage = Vector3.zero;
		currentVelocity = Vector3.zero;
		for (int i = 0; i < velocityHistory.Length; i++)
		{
			velocityHistory[i] = Vector3.zero;
		}
		if (Object.op_Implicit((Object)(object)bodyTransform))
		{
			lastPosition = bodyTransform.position;
		}
		wasLeftHandTouching = false;
		wasRightHandTouching = false;
	}

	private bool TransformsValid()
	{
		if (Object.op_Implicit((Object)(object)playerRigidBody) && Object.op_Implicit((Object)(object)bodyTransform) && Object.op_Implicit((Object)(object)head) && Object.op_Implicit((Object)(object)leftHandTransform))
		{
			return Object.op_Implicit((Object)(object)rightHandTransform);
		}
		return false;
	}

	private Vector3 CurrentHandPosition(Transform handTransform)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0057: 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)
		Vector3 position = handTransform.position;
		Vector3 val = position - head.position;
		if (((Vector3)(ref val)).magnitude < 1.5f)
		{
			return position;
		}
		Vector3 position2 = head.position;
		val = position - head.position;
		return position2 + ((Vector3)(ref val)).normalized * 1.5f;
	}

	public void Tick()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_00c6: 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)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: 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_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00ad: 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_009c: 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_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: 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_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: 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_00ba: 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_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: 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_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: 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_01a6: 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_024f: 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_01c2: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: 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_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: 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_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: 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_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: 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_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: 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_0348: 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_03eb: 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_03f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0414: Unknown result type (might be due to invalid IL or missing references)
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Unknown result type (might be due to invalid IL or missing references)
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0501: Unknown result type (might be due to invalid IL or missing references)
		//IL_0506: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0520: Unknown result type (might be due to invalid IL or missing references)
		//IL_0485: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: 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_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_053d: Unknown result type (might be due to invalid IL or missing references)
		if (!TransformsValid())
		{
			return;
		}
		float deltaTime = Time.deltaTime;
		bool flag = false;
		bool flag2 = false;
		Vector3 val = Vector3.zero;
		Vector3 val2 = Vector3.zero;
		Vector3 val3 = CurrentHandPosition(leftHandTransform);
		Vector3 val4 = CurrentHandPosition(rightHandTransform);
		Vector3 movementVector = val3 - lastLeftHandPosition + Vector3.down * 2f * 9.8f * deltaTime * deltaTime;
		if (IterativeCollisionSphereCast(lastLeftHandPosition, 0.05f, movementVector, 0.995f, out var endPosition, singleHand: true))
		{
			val = (wasLeftHandTouching ? (lastLeftHandPosition - val3) : (endPosition - val3));
			playerRigidBody.velocity = Vector3.zero;
			flag = true;
		}
		movementVector = val4 - lastRightHandPosition + Vector3.down * 2f * 9.8f * deltaTime * deltaTime;
		if (IterativeCollisionSphereCast(lastRightHandPosition, 0.05f, movementVector, 0.995f, out endPosition, singleHand: true))
		{
			val2 = (wasRightHandTouching ? (lastRightHandPosition - val4) : (endPosition - val4));
			playerRigidBody.velocity = Vector3.zero;
			flag2 = true;
		}
		Vector3 val5 = (((!flag && !wasLeftHandTouching) || (!flag2 && !wasRightHandTouching)) ? (val + val2) : ((val + val2) / 2f));
		Vector3 val8;
		LayerMask val9;
		RaycastHit val10 = default(RaycastHit);
		if (IterativeCollisionSphereCast(lastHeadPosition, 0.2f, head.position + val5 - lastHeadPosition, 0.995f, out endPosition, singleHand: false))
		{
			val5 = endPosition - lastHeadPosition;
			Vector3 val6 = lastHeadPosition;
			Vector3 val7 = head.position - lastHeadPosition + val5;
			val8 = head.position - lastHeadPosition + val5;
			float num = ((Vector3)(ref val8)).magnitude + 0.19880101f;
			val9 = locomotionEnabledLayers;
			if (Physics.Raycast(val6, val7, ref val10, num, ((LayerMask)(ref val9)).value))
			{
				val5 = lastHeadPosition - head.position;
			}
		}
		if (val5 != Vector3.zero)
		{
			Transform obj = bodyTransform;
			obj.position += val5;
		}
		lastHeadPosition = head.position;
		movementVector = CurrentHandPosition(leftHandTransform) - lastLeftHandPosition;
		if (IterativeCollisionSphereCast(lastLeftHandPosition, 0.05f, movementVector, 0.995f, out endPosition, (!flag && !wasLeftHandTouching) || (!flag2 && !wasRightHandTouching)))
		{
			lastLeftHandPosition = endPosition;
			flag = true;
		}
		else
		{
			lastLeftHandPosition = CurrentHandPosition(leftHandTransform);
		}
		movementVector = CurrentHandPosition(rightHandTransform) - lastRightHandPosition;
		if (IterativeCollisionSphereCast(lastRightHandPosition, 0.05f, movementVector, 0.995f, out endPosition, (!flag && !wasLeftHandTouching) || (!flag2 && !wasRightHandTouching)))
		{
			lastRightHandPosition = endPosition;
			flag2 = true;
		}
		else
		{
			lastRightHandPosition = CurrentHandPosition(rightHandTransform);
		}
		StoreVelocities();
		if ((flag2 || flag) && !disableMovement && ((Vector3)(ref denormalizedVelocityAverage)).magnitude > 0.4f)
		{
			if (((Vector3)(ref denormalizedVelocityAverage)).magnitude * 1.1f > 6.5f)
			{
				playerRigidBody.velocity = ((Vector3)(ref denormalizedVelocityAverage)).normalized * 6.5f;
			}
			else
			{
				playerRigidBody.velocity = 1.1f * denormalizedVelocityAverage;
			}
		}
		if (flag)
		{
			val8 = CurrentHandPosition(leftHandTransform) - lastLeftHandPosition;
			if (((Vector3)(ref val8)).magnitude > 1f)
			{
				Vector3 position = head.position;
				Vector3 val11 = CurrentHandPosition(leftHandTransform) - head.position;
				val8 = CurrentHandPosition(leftHandTransform) - head.position;
				float num2 = ((Vector3)(ref val8)).magnitude - 0.05f;
				val9 = locomotionEnabledLayers;
				if (!Physics.SphereCast(position, 0.04975f, val11, ref val10, num2, ((LayerMask)(ref val9)).value))
				{
					lastLeftHandPosition = CurrentHandPosition(leftHandTransform);
					flag = false;
				}
			}
		}
		if (flag2)
		{
			val8 = CurrentHandPosition(rightHandTransform) - lastRightHandPosition;
			if (((Vector3)(ref val8)).magnitude > 1f)
			{
				Vector3 position2 = head.position;
				Vector3 val12 = CurrentHandPosition(rightHandTransform) - head.position;
				val8 = CurrentHandPosition(rightHandTransform) - head.position;
				float num3 = ((Vector3)(ref val8)).magnitude - 0.05f;
				val9 = locomotionEnabledLayers;
				if (!Physics.SphereCast(position2, 0.04975f, val12, ref val10, num3, ((LayerMask)(ref val9)).value))
				{
					lastRightHandPosition = CurrentHandPosition(rightHandTransform);
					flag2 = false;
				}
			}
		}
		if (EnableHaptics)
		{
			if (flag && !wasLeftHandTouching)
			{
				Haptics.Pulse(leftHand: true, 0.45f, 0.06f);
			}
			if (flag2 && !wasRightHandTouching)
			{
				Haptics.Pulse(leftHand: false, 0.45f, 0.06f);
			}
		}
		wasLeftHandTouching = flag;
		wasRightHandTouching = flag2;
	}

	private bool IterativeCollisionSphereCast(Vector3 startPosition, float sphereRadius, Vector3 movementVector, float precision, out Vector3 endPosition, bool singleHand)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_0031: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_007c: 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_007e: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		if (CollisionsSphereCast(startPosition, sphereRadius * precision, movementVector, precision, out endPosition, out var hitInfo))
		{
			Vector3 val = endPosition;
			float num = ((!singleHand) ? 0.03f : 0.001f);
			Vector3 val2 = Vector3.ProjectOnPlane(startPosition + movementVector - val, ((RaycastHit)(ref hitInfo)).normal) * num;
			if (CollisionsSphereCast(endPosition, sphereRadius, val2, precision * precision, out endPosition, out hitInfo))
			{
				return true;
			}
			if (CollisionsSphereCast(val2 + val, sphereRadius, startPosition + movementVector - (val2 + val), precision * precision * precision, out endPosition, out hitInfo))
			{
				return true;
			}
			endPosition = val;
			return true;
		}
		if (CollisionsSphereCast(startPosition, sphereRadius * precision * 0.66f, ((Vector3)(ref movementVector)).normalized * (((Vector3)(ref movementVector)).magnitude + sphereRadius * precision * 0.34f), precision * 0.66f, out endPosition, out hitInfo))
		{
			endPosition = startPosition;
			return true;
		}
		endPosition = Vector3.zero;
		return false;
	}

	private bool CollisionsSphereCast(Vector3 startPosition, float sphereRadius, Vector3 movementVector, float precision, out Vector3 finalPosition, out RaycastHit hitInfo)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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_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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: 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_0109: 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)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: 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)
		//IL_013c: 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_0144: Unknown result type (might be due to invalid IL or missing references)
		float num = sphereRadius * precision;
		Vector3 val = movementVector;
		float num2 = ((Vector3)(ref movementVector)).magnitude + sphereRadius * (1f - precision);
		LayerMask val2 = locomotionEnabledLayers;
		if (Physics.SphereCast(startPosition, num, val, ref hitInfo, num2, ((LayerMask)(ref val2)).value))
		{
			finalPosition = ((RaycastHit)(ref hitInfo)).point + ((RaycastHit)(ref hitInfo)).normal * sphereRadius;
			float num3 = sphereRadius * precision * precision;
			Vector3 val3 = finalPosition - startPosition;
			Vector3 val4 = finalPosition - startPosition;
			float num4 = ((Vector3)(ref val4)).magnitude + sphereRadius * (1f - precision * precision);
			val2 = locomotionEnabledLayers;
			RaycastHit val5 = default(RaycastHit);
			if (Physics.SphereCast(startPosition, num3, val3, ref val5, num4, ((LayerMask)(ref val2)).value))
			{
				val4 = finalPosition - startPosition;
				finalPosition = startPosition + ((Vector3)(ref val4)).normalized * Mathf.Max(0f, ((RaycastHit)(ref hitInfo)).distance - sphereRadius * (1f - precision * precision));
				hitInfo = val5;
			}
			else
			{
				Vector3 val6 = finalPosition - startPosition;
				val4 = finalPosition - startPosition;
				float num5 = ((Vector3)(ref val4)).magnitude + sphereRadius * precision * precision * 0.999f;
				val2 = locomotionEnabledLayers;
				if (Physics.Raycast(startPosition, val6, ref val5, num5, ((LayerMask)(ref val2)).value))
				{
					finalPosition = startPosition;
					hitInfo = val5;
					return true;
				}
			}
			return true;
		}
		Vector3 val7 = movementVector;
		float num6 = ((Vector3)(ref movementVector)).magnitude + sphereRadius * precision * 0.999f;
		val2 = locomotionEnabledLayers;
		if (Physics.Raycast(startPosition, val7, ref hitInfo, num6, ((LayerMask)(ref val2)).value))
		{
			finalPosition = startPosition;
			return true;
		}
		finalPosition = Vector3.zero;
		return false;
	}

	private void StoreVelocities()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		velocityIndex = (velocityIndex + 1) % 8;
		Vector3 val = velocityHistory[velocityIndex];
		currentVelocity = (bodyTransform.position - lastPosition) / Time.deltaTime;
		denormalizedVelocityAverage += (currentVelocity - val) / 8f;
		velocityHistory[velocityIndex] = currentVelocity;
		lastPosition = bodyTransform.position;
	}
}
internal static class NetProps
{
	public static bool InRoom
	{
		get
		{
			try
			{
				return PhotonNetwork.InRoom;
			}
			catch
			{
				return false;
			}
		}
	}

	public static Player Master
	{
		get
		{
			try
			{
				return PhotonNetwork.MasterClient;
			}
			catch
			{
				return null;
			}
		}
	}

	public static Player[] PlayerList
	{
		get
		{
			try
			{
				return Il2CppArrayBase<Player>.op_Implicit((Il2CppArrayBase<Player>)(object)PhotonNetwork.PlayerList);
			}
			catch
			{
				return null;
			}
		}
	}

	public static void SetLocal(string key, string value)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		try
		{
			Player localPlayer = PhotonNetwork.LocalPlayer;
			if (localPlayer != null)
			{
				Hashtable val = new Hashtable();
				val[(Object)(object)String.op_Implicit(key)] = (Object)(object)String.op_Implicit(value);
				localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
			}
		}
		catch
		{
		}
	}

	public static string Get(Player p, string key)
	{
		try
		{
			if (p == null)
			{
				return null;
			}
			Hashtable customProperties = p.CustomProperties;
			if (customProperties == null)
			{
				return null;
			}
			String val = String.op_Implicit(key);
			if (!((Dictionary<Object, Object>)(object)customProperties).ContainsKey((Object)(object)val))
			{
				return null;
			}
			Object val2 = customProperties[(Object)(object)val];
			return (val2 != null) ? val2.ToString() : null;
		}
		catch
		{
			return null;
		}
	}

	public static bool Has(Player p, string key)
	{
		return Get(p, key) != null;
	}
}
public static class Haptics
{
	public static void Pulse(bool leftHand, float amplitude, float duration)
	{
		//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)
		try
		{
			InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode((XRNode)(leftHand ? 4 : 5));
			if (((InputDevice)(ref deviceAtXRNode)).isValid)
			{
				((InputDevice)(ref deviceAtXRNode)).SendHapticImpulse(0u, amplitude, duration);
			}
		}
		catch
		{
		}
	}
}
public class ButtonState
{
	public bool IsPressed { get; private set; }

	public bool WasPressed { get; private set; }

	public bool Pressed
	{
		get
		{
			if (IsPressed)
			{
				return !WasPressed;
			}
			return false;
		}
	}

	public bool Released
	{
		get
		{
			if (!IsPressed)
			{
				return WasPressed;
			}
			return false;
		}
	}

	public void UpdateState(bool currentState)
	{
		WasPressed = IsPressed;
		IsPressed = currentState;
	}
}
public static class RumbleLayers
{
	public static readonly int Moveable = 14;

	public static readonly int Spawnable = 9;

	public static readonly int Environment = 10;
}