Decompiled source of Backrooms v1.0.7

Backrooms.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Script")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Backrooms")]
[assembly: AssemblyTitle("Backrooms")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class PlaneMoverToggle : MonoBehaviourPun, IPunObservable
{
	private enum ElevatorState
	{
		Idle,
		ClosingDoors,
		MovingPlatform,
		OpeningDoors
	}

	private enum SoundEvent
	{
		DoorOpen,
		DoorClose,
		ArrivalDing
	}

	[Header("Platform Settings")]
	public Transform floor;

	public Transform pointA;

	public Transform pointB;

	public float speed = 2f;

	private Rigidbody floorRb;

	private bool movingToB = true;

	private bool isMoving = false;

	private bool isAtPointA = true;

	private bool hasPlayedOpenSound = false;

	private Vector3 networkPosition;

	private Vector3 velocity = Vector3.zero;

	[Header("Door Settings")]
	public float doorSpeed = 2f;

	public float doorCloseDelay = 1f;

	public float doorOpenDelay = 0.5f;

	[Header("Top Door")]
	public Transform topDoor;

	public Transform topDoorOpenPoint;

	public Transform topDoorClosedPoint;

	public AudioSource topDoorAudioSource;

	public AudioClip topDoorSound;

	[Header("Bottom Door")]
	public Transform bottomDoor;

	public Transform bottomDoorOpenPoint;

	public Transform bottomDoorClosedPoint;

	public AudioSource bottomDoorAudioSource;

	public AudioClip bottomDoorSound;

	[Header("Arrival Ding")]
	public AudioClip arrivalDing;

	public AudioSource topArrivalAudioSource;

	public AudioSource bottomArrivalAudioSource;

	[Header("Elevator Music")]
	public AudioClip elevatorMusic;

	public AudioSource elevatorMusicSource;

	private bool isMultiplayer;

	private ElevatorState state = ElevatorState.Idle;

	private float doorTimer = 0f;

	private Vector3 topDoorTargetPos;

	private Vector3 bottomDoorTargetPos;

	private void Start()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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)
		floorRb = ((Component)floor).GetComponent<Rigidbody>();
		isMultiplayer = PhotonNetwork.IsConnected && PhotonNetwork.InRoom;
		if (isMultiplayer && ((MonoBehaviourPun)this).photonView.IsMine)
		{
			PhotonNetwork.SendRate = 20;
			PhotonNetwork.SerializationRate = 10;
		}
		networkPosition = floor.position;
		topDoorTargetPos = topDoor.position;
		bottomDoorTargetPos = bottomDoor.position;
	}

	private void FixedUpdate()
	{
		//IL_009d: 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_00b3: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)floorRb) || !Object.op_Implicit((Object)(object)pointA) || !Object.op_Implicit((Object)(object)pointB))
		{
			return;
		}
		if (!isMultiplayer || ((MonoBehaviourPun)this).photonView.IsMine)
		{
			switch (state)
			{
			case ElevatorState.ClosingDoors:
				HandleDoorClosing();
				break;
			case ElevatorState.MovingPlatform:
				MovePlatform();
				break;
			case ElevatorState.OpeningDoors:
				HandleDoorOpening();
				break;
			}
		}
		else
		{
			floor.position = Vector3.SmoothDamp(floor.position, networkPosition, ref velocity, 0.1f);
			topDoor.position = Vector3.Lerp(topDoor.position, topDoorTargetPos, Time.fixedDeltaTime * doorSpeed);
			bottomDoor.position = Vector3.Lerp(bottomDoor.position, bottomDoorTargetPos, Time.fixedDeltaTime * doorSpeed);
		}
	}

	public void TriggerNextMove()
	{
		if (state == ElevatorState.Idle)
		{
			state = ElevatorState.ClosingDoors;
			doorTimer = doorCloseDelay;
			PlaySyncedSound(SoundEvent.DoorClose, GetCurrentDoorAudioSource());
		}
	}

	private void HandleDoorClosing()
	{
		if (!MoveDoor(GetCurrentDoor(), GetCurrentDoorClosedPoint(), doorSpeed))
		{
			return;
		}
		if (doorTimer > 0f)
		{
			doorTimer -= Time.fixedDeltaTime;
			return;
		}
		state = ElevatorState.MovingPlatform;
		isMoving = true;
		if (Object.op_Implicit((Object)(object)elevatorMusic) && Object.op_Implicit((Object)(object)elevatorMusicSource))
		{
			elevatorMusicSource.Play();
		}
	}

	private void MovePlatform()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: 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_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_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_0046: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = (movingToB ? pointB.position : pointA.position);
		Vector3 val2 = Vector3.MoveTowards(floor.position, val, speed * Time.fixedDeltaTime);
		floorRb.MovePosition(val2);
		if (Vector3.Distance(floor.position, val) < 0.01f)
		{
			isMoving = false;
			isAtPointA = !movingToB;
			movingToB = !movingToB;
			doorTimer = doorOpenDelay;
			state = ElevatorState.OpeningDoors;
			if (Object.op_Implicit((Object)(object)elevatorMusicSource) && elevatorMusicSource.isPlaying)
			{
				elevatorMusicSource.Stop();
			}
			PlaySyncedSound(SoundEvent.ArrivalDing, null);
		}
	}

	private void HandleDoorOpening()
	{
		if (doorTimer > 0f)
		{
			doorTimer -= Time.fixedDeltaTime;
			return;
		}
		if (state != ElevatorState.MovingPlatform && !hasPlayedOpenSound)
		{
			PlaySyncedSound(SoundEvent.DoorOpen, GetCurrentDoorAudioSource());
			hasPlayedOpenSound = true;
		}
		if (MoveDoor(GetCurrentDoor(), GetCurrentDoorOpenPoint(), doorSpeed))
		{
			state = ElevatorState.Idle;
			hasPlayedOpenSound = false;
		}
	}

	private bool MoveDoor(Transform door, Transform targetPoint, float speed)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)door) || !Object.op_Implicit((Object)(object)targetPoint))
		{
			return true;
		}
		Vector3 position = Vector3.MoveTowards(door.position, targetPoint.position, speed * Time.fixedDeltaTime);
		door.position = position;
		if (((MonoBehaviourPun)this).photonView.IsMine)
		{
			if ((Object)(object)door == (Object)(object)topDoor)
			{
				topDoorTargetPos = targetPoint.position;
			}
			if ((Object)(object)door == (Object)(object)bottomDoor)
			{
				bottomDoorTargetPos = targetPoint.position;
			}
		}
		return Vector3.Distance(door.position, targetPoint.position) < 0.01f;
	}

	private void PlaySyncedSound(SoundEvent sound, AudioSource source)
	{
		string text = (Object.op_Implicit((Object)(object)source) ? ((Object)((Component)source).gameObject).name : "");
		if (isMultiplayer)
		{
			((MonoBehaviourPun)this).photonView.RPC("RPC_PlaySound", (RpcTarget)0, new object[2]
			{
				(int)sound,
				text
			});
		}
		else
		{
			PlaySound(sound, source);
		}
	}

	[PunRPC]
	private void RPC_PlaySound(int soundType, string sourceName)
	{
		object obj;
		if (string.IsNullOrEmpty(sourceName))
		{
			obj = null;
		}
		else
		{
			GameObject obj2 = GameObject.Find(sourceName);
			obj = ((obj2 != null) ? obj2.GetComponent<AudioSource>() : null);
		}
		AudioSource src = (AudioSource)obj;
		PlaySound((SoundEvent)soundType, src);
	}

	private void PlaySound(SoundEvent soundType, AudioSource src)
	{
		switch (soundType)
		{
		case SoundEvent.DoorOpen:
			if (Object.op_Implicit((Object)(object)src) && Object.op_Implicit((Object)(object)GetCurrentDoorSound()))
			{
				src.PlayOneShot(GetCurrentDoorSound());
			}
			break;
		case SoundEvent.DoorClose:
			if (Object.op_Implicit((Object)(object)src) && Object.op_Implicit((Object)(object)GetCurrentDoorSound()))
			{
				src.PlayOneShot(GetCurrentDoorSound());
			}
			break;
		case SoundEvent.ArrivalDing:
			if (!isAtPointA && Object.op_Implicit((Object)(object)bottomArrivalAudioSource) && Object.op_Implicit((Object)(object)arrivalDing))
			{
				bottomArrivalAudioSource.PlayOneShot(arrivalDing);
			}
			else if (isAtPointA && Object.op_Implicit((Object)(object)topArrivalAudioSource) && Object.op_Implicit((Object)(object)arrivalDing))
			{
				topArrivalAudioSource.PlayOneShot(arrivalDing);
			}
			break;
		}
	}

	private Transform GetCurrentDoor()
	{
		return isAtPointA ? topDoor : bottomDoor;
	}

	private Transform GetCurrentDoorOpenPoint()
	{
		return isAtPointA ? topDoorOpenPoint : bottomDoorOpenPoint;
	}

	private Transform GetCurrentDoorClosedPoint()
	{
		return isAtPointA ? topDoorClosedPoint : bottomDoorClosedPoint;
	}

	private AudioSource GetCurrentDoorAudioSource()
	{
		return isAtPointA ? topDoorAudioSource : bottomDoorAudioSource;
	}

	private AudioClip GetCurrentDoorSound()
	{
		return isAtPointA ? topDoorSound : bottomDoorSound;
	}

	public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		if (isMultiplayer)
		{
			if (stream.IsWriting)
			{
				stream.SendNext((object)floor.position);
				stream.SendNext((object)topDoor.position);
				stream.SendNext((object)bottomDoor.position);
			}
			else
			{
				networkPosition = (Vector3)stream.ReceiveNext();
				topDoorTargetPos = (Vector3)stream.ReceiveNext();
				bottomDoorTargetPos = (Vector3)stream.ReceiveNext();
			}
		}
	}
}
public class LevelPointVisualizer : MonoBehaviour
{
	private LevelPoint[] levelPoints;

	private BoxCollider levelPointTrigger;

	private Vector3 offset = new Vector3(0.1f, 0f, 0.1f);

	private void OnDrawGizmos()
	{
		//IL_0072: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: 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_0116: 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_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: 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_0161: 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_016c: Unknown result type (might be due to invalid IL or missing references)
		levelPoints = ((Component)this).GetComponentsInChildren<LevelPoint>();
		if (levelPoints == null || levelPoints.Length == 0)
		{
			return;
		}
		LevelPoint[] array = levelPoints;
		LevelPoint[] array2 = array;
		foreach (LevelPoint val in array2)
		{
			levelPointTrigger = ((Component)val).gameObject.GetComponent<BoxCollider>();
			if (val.ModuleConnect)
			{
				Gizmos.color = Color.yellow;
			}
			else
			{
				Gizmos.color = Color.green;
			}
			Gizmos.DrawCube(((Component)val).transform.position + levelPointTrigger.center, levelPointTrigger.size);
			if (val.ConnectedPoints == null || levelPoints.Length == 0)
			{
				continue;
			}
			foreach (LevelPoint connectedPoint in val.ConnectedPoints)
			{
				List<LevelPoint> connectedPoints = connectedPoint.ConnectedPoints;
				if (connectedPoints.Contains(val))
				{
					Gizmos.color = Color.green;
					Gizmos.DrawLine(((Component)connectedPoint).transform.position + offset, ((Component)val).transform.position + offset);
					Gizmos.DrawLine(((Component)val).transform.position - offset, ((Component)connectedPoint).transform.position - offset);
				}
				else
				{
					Gizmos.color = Color.red;
					Gizmos.DrawLine(((Component)connectedPoint).transform.position, ((Component)val).transform.position);
				}
			}
		}
	}
}
[BepInPlugin("com.Backrooms", "Backrooms", "1.0.6")]
public class ModuleSize : BaseUnityPlugin
{
	private void Awake()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Backrooms mod loaded.");
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (((Scene)(ref scene)).name == "Main")
		{
			ApplyCustomModuleWidth();
		}
	}

	private void ApplyCustomModuleWidth()
	{
		try
		{
			if (!((Object)(object)RunManager.instance.levelCurrent == (Object)null))
			{
				string name = ((Object)RunManager.instance.levelCurrent).name;
				if (name == "Level - Backrooms")
				{
					LevelGenerator.ModuleWidth = 6f;
				}
				else
				{
					LevelGenerator.ModuleWidth = 3f;
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)$"Module size error: {arg}");
		}
	}
}
public class PlaneMover : MonoBehaviourPun, IPunObservable
{
	public Transform? pointA;

	public Transform? pointB;

	private Rigidbody? rb;

	public float speed = 2f;

	private bool movingToB = true;

	private Vector3 networkPosition;

	private Vector3 velocity = Vector3.zero;

	[Header("Debug Settings")]
	public bool enableDebug = true;

	public float logInterval = 1f;

	private float lastLogTime = 0f;

	private Vector3 lastPosition;

	private bool isMultiplayer;

	private void Start()
	{
		//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_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		rb = ((Component)this).GetComponent<Rigidbody>();
		lastPosition = ((Component)this).transform.position;
		isMultiplayer = PhotonNetwork.IsConnected && PhotonNetwork.InRoom;
		if (enableDebug)
		{
			Debug.Log((object)("[PlaneMover] Multiplayer = " + isMultiplayer));
			if (isMultiplayer)
			{
				Debug.Log((object)("[PlaneMover] PhotonView.IsMine = " + ((MonoBehaviourPun)this).photonView.IsMine + " | IsMasterClient = " + PhotonNetwork.IsMasterClient));
			}
		}
		if (isMultiplayer && ((MonoBehaviourPun)this).photonView.IsMine)
		{
			networkPosition = ((Component)this).transform.position;
			PhotonNetwork.SendRate = 20;
			PhotonNetwork.SerializationRate = 10;
		}
	}

	private void FixedUpdate()
	{
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: 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_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)pointA == (Object)null || (Object)(object)pointB == (Object)null || (Object)(object)rb == (Object)null)
		{
			if (enableDebug)
			{
				Debug.LogWarning((object)"[PlaneMover] Not properly initialized. Missing pointA/pointB or Rigidbody.");
			}
			return;
		}
		if (!isMultiplayer)
		{
			MoveObject();
		}
		else if (((MonoBehaviourPun)this).photonView.IsMine)
		{
			MoveObject();
		}
		else
		{
			Vector3 position = ((Component)this).transform.position;
			((Component)this).transform.position = Vector3.SmoothDamp(((Component)this).transform.position, networkPosition, ref velocity, 0.1f);
			if (enableDebug && Time.time - lastLogTime >= logInterval)
			{
				string[] obj = new string[7] { "[PlaneMover] Syncing position: ", null, null, null, null, null, null };
				Vector3 val = position;
				obj[1] = ((object)(Vector3)(ref val)).ToString();
				obj[2] = " → ";
				val = ((Component)this).transform.position;
				obj[3] = ((object)(Vector3)(ref val)).ToString();
				obj[4] = " (Target: ";
				val = networkPosition;
				obj[5] = ((object)(Vector3)(ref val)).ToString();
				obj[6] = ")";
				Debug.Log((object)string.Concat(obj));
				lastLogTime = Time.time;
			}
		}
		lastPosition = ((Component)this).transform.position;
	}

	private void MoveObject()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: 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_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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: 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_0085: 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_009a: 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)
		Vector3 val = (movingToB ? pointB.position : pointA.position);
		Vector3 position = ((Component)this).transform.position;
		Vector3 val2 = Vector3.MoveTowards(((Component)this).transform.position, val, speed * Time.fixedDeltaTime);
		rb.MovePosition(val2);
		if (enableDebug && Time.time - lastLogTime >= logInterval)
		{
			Vector3 val3 = position;
			string? text = ((object)(Vector3)(ref val3)).ToString();
			val3 = val2;
			Debug.Log((object)("[PlaneMover] Moved from " + text + " to " + ((object)(Vector3)(ref val3)).ToString()));
			lastLogTime = Time.time;
		}
		if (Vector3.Distance(((Component)this).transform.position, val) < 0.01f)
		{
			movingToB = !movingToB;
			if (enableDebug)
			{
				string text2 = (movingToB ? "B" : "A");
				Debug.Log((object)("[PlaneMover] Switching direction. New Target: " + text2));
			}
		}
	}

	public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
	{
		//IL_00e0: 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_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_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_0119: 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_00aa: 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)
		if (!isMultiplayer)
		{
			return;
		}
		Vector3 val;
		if (stream.IsWriting)
		{
			val = ((Component)this).transform.position - lastPosition;
			if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
			{
				stream.SendNext((object)((Component)this).transform.position);
				lastPosition = ((Component)this).transform.position;
				if (enableDebug && Time.time - lastLogTime >= logInterval)
				{
					val = ((Component)this).transform.position;
					Debug.Log((object)("[PlaneMover] Sending position: " + ((object)(Vector3)(ref val)).ToString()));
					lastLogTime = Time.time;
				}
			}
		}
		else
		{
			networkPosition = (Vector3)stream.ReceiveNext();
			if (enableDebug && Time.time - lastLogTime >= logInterval)
			{
				val = networkPosition;
				Debug.Log((object)("[PlaneMover] Received position: " + ((object)(Vector3)(ref val)).ToString()));
				lastLogTime = Time.time;
			}
		}
	}
}
public class ValuableVolumeVisualizer : MonoBehaviour
{
	private void OnDrawGizmos()
	{
		//IL_001c: 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_0039: 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_005e: 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_0070: 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_0086: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_00a7: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: 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_00c5: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: 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_0131: 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)
		BoxCollider component = ((Component)this).GetComponent<BoxCollider>();
		Gizmos.color = new Color(1f, 1.18f, 0f, 6f);
		Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
		Gizmos.DrawWireCube(component.center, component.size);
		Gizmos.color = new Color(1f, 1.18f, 0f, 0.2f);
		Gizmos.DrawCube(component.center, component.size);
		Gizmos.color = Color.white;
		Gizmos.matrix = Matrix4x4.identity;
		Bounds bounds = ((Collider)component).bounds;
		Vector3 center = ((Bounds)(ref bounds)).center;
		Vector3 val = center + ((Component)this).transform.forward * 0.5f;
		Gizmos.DrawLine(center, val);
		Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, -((Component)this).transform.right, 0.5f) * 0.25f);
		Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, ((Component)this).transform.right, 0.5f) * 0.25f);
	}
}
namespace Backrooms
{
	[BepInPlugin("Script.Backrooms", "Backrooms", "1.0")]
	public class Backrooms : BaseUnityPlugin
	{
		internal static Backrooms Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//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_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
	[HarmonyPatch(typeof(PlayerController))]
	internal static class ExamplePlayerControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerController __instance)
		{
			Backrooms.Logger.LogDebug((object)$"{__instance} Start Prefix");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PlayerController __instance)
		{
			Backrooms.Logger.LogDebug((object)$"{__instance} Start Postfix");
		}
	}
}