Decompiled source of PintoBoy v2.0.3

PintoBoy.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using PintoMod;
using PintoMod.Assets.Scripts;
using PintoMod.Assets.Scripts.FacilityDash;
using PintoMod.Assets.Scripts.LethalJumpany;
using PintoMod.Properties;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Pinto_Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pinto_Mod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ff99ad61-38a5-4085-a181-d080e129d86e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyInformationalVersion("1.0.0+63493ffadcc7e18e83efc4af948140b940a7788b")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Color32>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<Color32>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<FDHallwayState>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<FDHallwayState>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<FDPlayerState>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<FDPlayerState>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 enum PintoEnemyType
{
	Spider,
	Slime,
	Lootbug
}
public class LJEnemy : NetworkBehaviour
{
	public PintoEnemyType enemyType;

	public float speed = 5f;

	private float distance;

	public LethalJumpany game;

	public UnityEvent<LJEnemy> onDeath = new UnityEvent<LJEnemy>();

	public Animator animator;

	public bool paused = false;

	public bool killedPlayer = false;

	private AudioClip[] movementSounds;

	private float currentMovementSoundTimer = 0f;

	private int currentMovementSoundIndex = 0;

	public NetworkVariable<int> parentNetworkID = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

	private void Awake()
	{
		distance = 10f;
		animator = ((Component)this).GetComponent<Animator>();
	}

	private void Update()
	{
		//IL_0059: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		if (!((GrabbableObject)game).isBeingUsed)
		{
			return;
		}
		if (killedPlayer)
		{
			if (enemyType == PintoEnemyType.Spider)
			{
				((Behaviour)animator).enabled = false;
			}
			return;
		}
		float num = speed * Time.deltaTime;
		Transform transform = ((Component)this).transform;
		transform.position += Vector3.left * num;
		distance -= num;
		if (distance < 0f)
		{
			onDeath.Invoke(this);
		}
		currentMovementSoundTimer -= Time.deltaTime;
		if (currentMovementSoundTimer < 0f)
		{
			game.PlaySound(movementSounds[currentMovementSoundIndex]);
			currentMovementSoundIndex++;
			if (currentMovementSoundIndex >= movementSounds.Length)
			{
				currentMovementSoundIndex = 0;
			}
			currentMovementSoundTimer = movementSounds[currentMovementSoundIndex].length;
		}
	}

	private void OnTriggerEnter2D(Collider2D collision)
	{
		if (((Component)collision).gameObject.CompareTag("Player") && (Object)(object)game != (Object)null)
		{
			game.PlayerGotHit();
		}
	}

	public void SetMovementSounds(AudioClip[] audioClips)
	{
		movementSounds = audioClips;
		currentMovementSoundTimer = movementSounds[0].length;
		game.PlaySound(movementSounds[0]);
	}

	protected override void __initializeVariables()
	{
		if (parentNetworkID == null)
		{
			throw new Exception("LJEnemy.parentNetworkID cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)parentNetworkID).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)parentNetworkID, "parentNetworkID");
		base.NetworkVariableFields.Add((NetworkVariableBase)(object)parentNetworkID);
		((NetworkBehaviour)this).__initializeVariables();
	}

	protected internal override string __getTypeName()
	{
		return "LJEnemy";
	}
}
public enum FadeState
{
	FadeOff,
	FadeOn,
	FadeIn,
	FadeOut
}
public class PintoBoy : GrabbableObject
{
	private AudioSource audioSource;

	private bool isButtonPressing = false;

	protected bool isHoldingButton = false;

	public GameObject cam;

	private Transform trCam2DScene;

	private GameObject modelScreen;

	private Transform cartridgeLocation;

	private Animator animButton;

	private ScanNodeProperties scanNodeProperties;

	private float hideStartHoldTime = 0.2f;

	private float hideStartHoldTimer = 0f;

	public bool pressButton = false;

	private bool spawnScreen = true;

	private Material matRenderTex = null;

	private RenderTexture texRenderTex = null;

	public bool isActive;

	public bool isPaused;

	public bool isInGame;

	public bool wasInitialized = false;

	private Renderer rendModelScreen;

	private float newGameOffset = 20f;

	private Coroutine coroutineButtonBeingPressed;

	public NetworkVariable<float> highScore = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

	public NetworkVariable<float> currentScore = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

	public NetworkVariable<int> health = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

	public NetworkVariable<Color32> color = new NetworkVariable<Color32>(default(Color32), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

	private Color32 bodyColor;

	private bool colorSet = false;

	private bool testcolor = false;

	protected void PintoAwake()
	{
		//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_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_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Expected O, but got Unknown
		//IL_024a: 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_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		audioSource = ((Component)this).GetComponent<AudioSource>();
		Debug.Log((object)"PintoBoy Awake");
		base.propColliders = (Collider[])(object)new Collider[2];
		base.propColliders[0] = ((Component)this).GetComponent<Collider>();
		base.propColliders[1] = ((Component)((Component)this).transform.Find("ScanNode")).GetComponent<Collider>();
		Debug.Log((object)(((Object)this).name + " propColliders Length:" + base.propColliders.Length));
		Debug.Log((object)(((Object)this).name + " propColliders Length:" + base.propColliders.Length + ", item 0:" + (object)base.propColliders[0]));
		base.mainObjectRenderer = ((Component)((Component)this).transform.Find("Model")).GetComponent<MeshRenderer>();
		base.originalScale = new Vector3(0.25f, 0.25f, 0.25f);
		Debug.Log((object)(((Object)this).name + " mainObjectRenderer: " + ((Object)base.mainObjectRenderer).name));
		scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
		if ((Object)(object)scanNodeProperties == (Object)null)
		{
			Debug.Log((object)"scanNodePoperties null af tbh");
		}
		base.useCooldown = 0.1f;
		base.grabbable = true;
		base.parentObject = ((Component)this).transform;
		Debug.Log((object)"scannode start");
		base.grabbableToEnemies = true;
		Debug.Log((object)"scannode done");
		modelScreen = ((Component)((Component)this).transform.Find("Model/Screen")).gameObject;
		animButton = ((Component)((Component)this).transform.Find("Model/Button")).GetComponent<Animator>();
		base.startFallingPosition = new Vector3(0f, 0f, 0f);
		base.targetFloorPosition = new Vector3(0f, 0f, 0f);
		base.insertedBattery = new Battery(false, 1f);
		((GrabbableObject)this).EnableItemMeshes(true);
		cartridgeLocation = ((Component)base.mainObjectRenderer).transform.Find("Cartridge");
		Debug.Log((object)("cartLoc.childcount:" + cartridgeLocation.childCount));
		if (Color32.op_Implicit(color.Value) != Color.black)
		{
			SetBodyColor(color.Value);
		}
	}

	protected void PintoBoyUpdate()
	{
		//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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		if (Color32.op_Implicit(color.Value) != Color.black)
		{
			SetBodyColor(color.Value);
		}
		if (((NetworkBehaviour)this).IsServer && (!colorSet || testcolor))
		{
			Debug.Log((object)"PintoBoy: setting body color");
			string[] array = new string[10] { "#FFFFFF", "#575757", "#FF6B6B", "#FFDAB9", "#FFFFCC", "#98FF98", "#008080", "#5999BE", "#CBCBFF", "#D9AEDD" };
			Color32[] array2 = (Color32[])(object)new Color32[array.Length];
			Color val = default(Color);
			for (int i = 0; i < array.Length; i++)
			{
				ColorUtility.TryParseHtmlString(array[i], ref val);
				array2[i] = Color32.op_Implicit(val);
			}
			ChangeBodyColorServerRpc(Color32.op_Implicit(array2[Random.Range(0, array2.Length)]));
			colorSet = true;
			testcolor = false;
		}
		if (spawnScreen)
		{
			SpawnScreen();
			Debug.Log((object)$"PintoBoy: spawning screen. cam: {cam}");
			spawnScreen = false;
			cam.transform.parent = null;
			cam.GetComponent<Camera>().orthographicSize = 1.5f;
			cam.transform.position = ((Component)this).transform.position + Vector3.down * 400f;
			cam.transform.rotation = Quaternion.identity;
			cam.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
			if (cam.transform.position.x == 0f || cam.transform.position.z == 0f)
			{
				cam.transform.position = new Vector3(Random.Range(-500f, 500f), cam.transform.position.y, Random.Range(-500f, 500f));
			}
			SetScreenToOffTexture();
			base.isBeingUsed = true;
			TurnOff(checkBeingUsed: true);
		}
		if (!base.isBeingUsed)
		{
			return;
		}
		isHoldingButton = false;
		if (base.isBeingUsed)
		{
			if (isButtonPressing)
			{
				if (hideStartHoldTimer > 0f)
				{
					hideStartHoldTimer -= Time.deltaTime;
				}
				else
				{
					isHoldingButton = true;
				}
			}
			GameUpdate();
		}
		if (pressButton)
		{
			ButtonPress();
			pressButton = false;
		}
	}

	public virtual void GameUpdate()
	{
	}

	public virtual void TurnedOn()
	{
	}

	public virtual void InitializeObjects(Transform gameRoot)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("Intiailizing PintoBoyGame: " + ((Object)this).name));
		wasInitialized = true;
		gameRoot.localPosition = Vector3.zero;
		gameRoot.localRotation = Quaternion.identity;
		gameRoot.localScale = Vector3.one;
	}

	public override void ItemInteractLeftRight(bool right)
	{
		((GrabbableObject)this).ItemInteractLeftRight(right);
		if (!right)
		{
			ToggleOnOff();
		}
	}

	public override void DiscardItem()
	{
		((GrabbableObject)this).DiscardItem();
		base.isBeingUsed = false;
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
		base.playerHeldBy.equippedUsableItemQE = true;
	}

	public virtual void ButtonPress()
	{
	}

	public virtual void ButtonRelease(float timeHeld)
	{
	}

	public override void UseUpBatteries()
	{
		Debug.Log((object)"PintoBoy battery used up");
		((GrabbableObject)this).UseUpBatteries();
		TurnOff(checkBeingUsed: false);
	}

	private void TogglePause()
	{
		if (isPaused)
		{
			UnPause();
		}
		else
		{
			Pause();
		}
	}

	private void Pause()
	{
		if (base.isBeingUsed)
		{
			isPaused = true;
			SetScreenToOffTexture();
			audioSource.Stop();
		}
	}

	private void UnPause()
	{
		if (!base.isBeingUsed)
		{
			isPaused = false;
		}
	}

	private void ToggleOnOff()
	{
		if (!base.isBeingUsed)
		{
			TurnOn();
		}
		else
		{
			TurnOff(checkBeingUsed: true);
		}
	}

	private void TurnOff(bool checkBeingUsed)
	{
		if (!(!base.isBeingUsed && checkBeingUsed))
		{
			base.isBeingUsed = false;
			SetScreenToOffTexture();
			audioSource.Stop();
			ResetGame();
		}
	}

	private void TurnOn()
	{
		if (!base.isBeingUsed)
		{
			base.isBeingUsed = true;
			SetScreenToRenderTexture();
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		isButtonPressing = buttonDown;
		if (buttonDown)
		{
			animButton.SetBool("Press", true);
			ButtonPress();
			if (coroutineButtonBeingPressed != null)
			{
				((MonoBehaviour)this).StopCoroutine(coroutineButtonBeingPressed);
			}
			coroutineButtonBeingPressed = ((MonoBehaviour)this).StartCoroutine(ButtonBeingPressed());
		}
	}

	private IEnumerator ButtonBeingPressed()
	{
		Debug.Log((object)("Pinto Button being pressed" + Time.time));
		float buttonStartPress = Time.time;
		yield return (object)new WaitUntil((Func<bool>)(() => !isButtonPressing || !base.isHeld));
		Debug.Log((object)("Pinto Button end press " + Time.deltaTime));
		animButton.SetBool("Press", false);
		if (base.isBeingUsed)
		{
			ButtonRelease(Time.time - buttonStartPress);
		}
	}

	public void PlaySound(AudioClip clip)
	{
		audioSource.PlayOneShot(clip);
	}

	public void StopSounds()
	{
		audioSource.Stop();
	}

	public void MakeScreenNOTSpawnable()
	{
		spawnScreen = false;
	}

	[ServerRpc]
	private void SpawnScreenServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2495713638u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2495713638u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			Debug.Log((object)"SpawnScreenServerRpc Called");
			int currentId = Pinto_ModBase.Instance.Value.currentId;
			PintoBoy[] array = (PintoBoy[])(object)Object.FindObjectsByType(typeof(PintoBoy), (FindObjectsSortMode)0);
			for (int i = currentId; i < array.Length + currentId; i++)
			{
				Debug.Log((object)"SpawnScreenServerRpc Called");
			}
			Pinto_ModBase.Instance.Value.currentId += array.Length;
			SpawnScreenClientRpc();
		}
	}

	[ClientRpc]
	private void SpawnScreenClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(491405224u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 491405224u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"SpawnScreenClientRpc Called");
				SpawnScreen();
			}
		}
	}

	private void SpawnScreen()
	{
		Debug.Log((object)"Trying spawn screen");
		if (!((Object)(object)cam != (Object)null))
		{
			Debug.Log((object)"Spawning Screen");
			cam = ((Component)((Component)this).transform.Find("2D Cam")).gameObject;
			cam.AddComponent<PintoCam>();
			if ((Object)(object)cam == (Object)null)
			{
				Debug.Log((object)"Screen in Pintoboy is null even after instantiate");
			}
			SetScreenToRenderTexture();
			trCam2DScene = cam.transform.Find("2D Scene");
			Debug.Log((object)"Initializing currentGame");
			InitializeObjects(cam.transform.Find("2D Scene/Game"));
			spawnScreen = false;
		}
	}

	private void GetChildRecursive(Transform obj, int level)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		if ((Object)null == (Object)(object)obj)
		{
			return;
		}
		foreach (Transform item in ((Component)obj).transform)
		{
			Transform val = item;
			if (!((Object)null == (Object)(object)val))
			{
				Debug.Log((object)string.Concat(string.Concat(Enumerable.Repeat("*", level)), ((Object)obj).name));
				GetChildRecursive(((Component)val).transform, level++);
			}
		}
	}

	private void SetScreenToRenderTexture()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		Debug.Log((object)"SetScreenRendTex: checking if texRenderTex null");
		if ((Object)(object)texRenderTex == (Object)null)
		{
			Debug.Log((object)("SetScreenRendTex: texRenderTex is null. Setting. cam:" + (object)cam));
			texRenderTex = new RenderTexture(120, 120, 16);
			((Object)texRenderTex).name = "PintoBoyScreen";
			((Texture)texRenderTex).filterMode = (FilterMode)0;
			cam.GetComponent<Camera>().targetTexture = texRenderTex;
		}
		Debug.Log((object)"SetScreenRendTex: checking if matRenderTex null");
		if ((Object)(object)matRenderTex == (Object)null)
		{
			Debug.Log((object)"SetScreenRendTex: matRenderTex is null. Setting");
			matRenderTex = Object.Instantiate<Material>(Pinto_ModBase.matOnScreen);
			matRenderTex.SetTexture("_MainTex", (Texture)(object)texRenderTex);
			matRenderTex.mainTexture = (Texture)(object)texRenderTex;
		}
		Debug.Log((object)"SetScreenRendTex: checking if rendModelScreen is null");
		if ((Object)(object)rendModelScreen == (Object)null)
		{
			Debug.Log((object)"SetScreenRendTex: rendModelScreen is null");
			rendModelScreen = modelScreen.GetComponent<Renderer>();
		}
		Debug.Log((object)"SetScreenRendTex: setting rendModelScreen to matRenderTex");
		rendModelScreen.material = matRenderTex;
	}

	private void SetScreenToOffTexture()
	{
		if ((Object)(object)rendModelScreen == (Object)null)
		{
			rendModelScreen = modelScreen.GetComponent<Renderer>();
		}
		rendModelScreen.material = Pinto_ModBase.matOffScreen;
		ResetGame();
	}

	public virtual void ResetGame()
	{
	}

	[ServerRpc]
	private void ChangeBodyColorServerRpc(Color newColor)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Invalid comparison between Unknown and I4
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: 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_00cf: 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_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1860633010u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1860633010u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((Renderer)base.mainObjectRenderer).materials[0].color = newColor;
			Debug.Log((object)("PintoBoy: server body color to:" + ((object)(Color)(ref newColor)).ToString()));
			color.Value = Color32.op_Implicit(newColor);
			SetBodyColorClientRpc(newColor.r, newColor.g, newColor.b);
		}
	}

	[ClientRpc]
	private void SetBodyColorClientRpc(float r, float g, float b)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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_007d: 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_0098: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(724987829u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref r, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref g, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref b, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 724987829u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"PintoBoy: client body color");
				((Renderer)base.mainObjectRenderer).materials[0].color = new Color(r, g, b);
			}
		}
	}

	private void SetBodyColor(Color32 newColor)
	{
		//IL_000e: 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)
		((Renderer)base.mainObjectRenderer).materials[0].color = Color32.op_Implicit(newColor);
	}

	protected override void __initializeVariables()
	{
		if (highScore == null)
		{
			throw new Exception("PintoBoy.highScore cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)highScore).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)highScore, "highScore");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)highScore);
		if (currentScore == null)
		{
			throw new Exception("PintoBoy.currentScore cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)currentScore).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentScore, "currentScore");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentScore);
		if (health == null)
		{
			throw new Exception("PintoBoy.health cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)health).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)health, "health");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)health);
		if (color == null)
		{
			throw new Exception("PintoBoy.color cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)color).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)color, "color");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)color);
		((GrabbableObject)this).__initializeVariables();
	}

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_PintoBoy()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(2495713638u, new RpcReceiveHandler(__rpc_handler_2495713638));
		NetworkManager.__rpc_func_table.Add(491405224u, new RpcReceiveHandler(__rpc_handler_491405224));
		NetworkManager.__rpc_func_table.Add(1860633010u, new RpcReceiveHandler(__rpc_handler_1860633010));
		NetworkManager.__rpc_func_table.Add(724987829u, new RpcReceiveHandler(__rpc_handler_724987829));
	}

	private static void __rpc_handler_2495713638(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PintoBoy)(object)target).SpawnScreenServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_491405224(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0029: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((PintoBoy)(object)target).SpawnScreenClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1860633010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			Color newColor = default(Color);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PintoBoy)(object)target).ChangeBodyColorServerRpc(newColor);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_724987829(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0065: 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_007a: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			float r = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref r, default(ForPrimitives));
			float g = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref g, default(ForPrimitives));
			float b = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref b, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((PintoBoy)(object)target).SetBodyColorClientRpc(r, g, b);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "PintoBoy";
	}
}
namespace PintoMod
{
	[BepInPlugin("Pinta.PintoBoy", "PintoBoy", "2.0.0")]
	public class Pinto_ModBase : BaseUnityPlugin
	{
		public const string MODGUID = "Pinta.PintoBoy";

		public const string MODNAME = "PintoBoy";

		public const string MODVERSION = "2.0.0";

		private readonly Harmony harmony = new Harmony("Pinta.PintoBoy");

		public ManualLogSource logger;

		public static ConfigEntry<float> config_PintoBoyLethalJumpanyRarity;

		public static ConfigEntry<float> config_PintoBoyFacilityDashRarity;

		public static ConfigEntry<float> config_PintoBoy;

		public static readonly Lazy<Pinto_ModBase> Instance = new Lazy<Pinto_ModBase>(() => new Pinto_ModBase());

		public static AssetBundle pintoBundle;

		public static Item itemPintoBoyPrefab;

		public static Material matOffScreen;

		public static Material matOnScreen;

		public static Item itemPintoBoyLJ;

		public static Item itemLJCartridgePrefab;

		public static LethalJumpany gameLethalJumpanyPrefab;

		public static GameObject ljSpiderPrefab;

		public static GameObject ljSlimePrefab;

		public static GameObject ljLootbugPrefab;

		public static Item itemPintoBoyFD;

		public static Item itemFDCartridgePrefab;

		public static FacilityDash gameFacilityDashPrefab;

		public static GameObject fdBrackenPrefab;

		public static GameObject fdBunkerSpiderPrefab;

		public static GameObject fdLootBugPrefab;

		public static GameObject fdNutcrackerPrefab;

		public static GameObject fdSnareFleaPrefab;

		public static GameObject fdThumperPrefab;

		public int currentId = 0;

		public static string basePath = "assets/pintoboy";

		public static string devicePath = basePath + "/device";

		public static string gamesPath = basePath + "/games";

		public static string ljBasePath = gamesPath + "/lethal jumpany";

		public static string ljAudioPath = ljBasePath + "/audio/";

		public static string ljSpritesPath = ljBasePath + "/2d";

		public static string fdBasePath = gamesPath + "/facility dash";

		public static string fdAudioPath = fdBasePath + "/audio/";

		public static string fdSpritesPath = fdBasePath + "/sprites/monsters";

		private void Awake()
		{
			logger = Logger.CreateLogSource("Pinto Mod");
			ConfigSetup();
			LoadBundle();
			SetVariables();
			harmony.PatchAll(typeof(Pinto_ModBase));
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			Debug.Log((object)"Pintoboy initialized");
		}

		private void ConfigSetup()
		{
			config_PintoBoyLethalJumpanyRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Lethal Jumpany PintoBoy", "Value", 25f, "How rare is the PintoBoy with Lethal Jumpany");
			config_PintoBoyFacilityDashRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Facility Dash PintoBoy", "Value", 12f, "How rare is the PintoBoy with Facility Dash");
		}

		private void SetVariables()
		{
			NetworkPrefabs.RegisterNetworkPrefab(itemPintoBoyPrefab.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(itemPintoBoyLJ.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(itemPintoBoyFD.spawnPrefab);
			Items.RegisterScrap(itemPintoBoyLJ, (int)config_PintoBoyLethalJumpanyRarity.Value, (LevelTypes)(-1));
			Items.RegisterScrap(itemPintoBoyFD, (int)config_PintoBoyFacilityDashRarity.Value, (LevelTypes)(-1));
		}

		private void LoadBundle()
		{
			pintoBundle = AssetBundle.LoadFromMemory(Resources.pintobund);
			if ((Object)(object)pintoBundle == (Object)null)
			{
				throw new Exception("Failed to load Pinto Bundle!");
			}
			itemPintoBoyPrefab = pintoBundle.LoadAsset<Item>(basePath + "/pintoboy.asset");
			if ((Object)(object)itemPintoBoyPrefab == (Object)null)
			{
				throw new Exception("Failed to load Pinto Item!");
			}
			PintoBoy pintoBoy = itemPintoBoyPrefab.spawnPrefab.AddComponent<PintoBoy>();
			if ((Object)(object)pintoBoy == (Object)null)
			{
				throw new Exception("Failed to load Pinto Boy!");
			}
			((GrabbableObject)pintoBoy).itemProperties = itemPintoBoyPrefab;
			matOffScreen = pintoBundle.LoadAsset<Material>(devicePath + "/off screen.mat");
			if ((Object)(object)matOffScreen == (Object)null)
			{
				throw new Exception("Failed to load off screen material!");
			}
			matOnScreen = pintoBundle.LoadAsset<Material>("Screen Mat.mat");
			if ((Object)(object)matOnScreen == (Object)null)
			{
				throw new Exception("Failed to load Screen Mat material!");
			}
			GameObject val = pintoBundle.LoadAsset<GameObject>(ljSpritesPath + "/spider/spider.prefab");
			if ((Object)(object)val == (Object)null)
			{
				throw new Exception("Failed to load Spider Prefab Object!");
			}
			val.AddComponent<LJEnemy>();
			ljSpiderPrefab = val;
			if ((Object)(object)ljSpiderPrefab == (Object)null)
			{
				throw new Exception("Failed to load Spider Prefab!");
			}
			GameObject val2 = pintoBundle.LoadAsset<GameObject>(ljSpritesPath + "/slime/slime.prefab");
			if ((Object)(object)val2 == (Object)null)
			{
				throw new Exception("Failed to load Slime Prefab Object!");
			}
			val2.AddComponent<LJEnemy>();
			ljSlimePrefab = val2;
			if ((Object)(object)ljSlimePrefab == (Object)null)
			{
				throw new Exception("Failed to load Slime Prefab!");
			}
			GameObject val3 = pintoBundle.LoadAsset<GameObject>(ljSpritesPath + "/loot bug/loot bug.prefab");
			if ((Object)(object)val3 == (Object)null)
			{
				throw new Exception("Failed to load Lootbug Prefab Object!");
			}
			val3.AddComponent<LJEnemy>();
			ljLootbugPrefab = val3;
			if ((Object)(object)ljLootbugPrefab == (Object)null)
			{
				throw new Exception("Failed to load Lootbug Prefab!");
			}
			string text = "";
			AudioClip audioClip = GetAudioClip(fdAudioPath + "67_knock (Player hit)");
			text = "Bracken";
			fdBrackenPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab");
			if ((Object)(object)fdBrackenPrefab == (Object)null)
			{
				throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab"));
			fdBrackenPrefab.AddComponent<FD_Bracken>();
			text = "Bunker Spider";
			fdBunkerSpiderPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab");
			if ((Object)(object)fdBunkerSpiderPrefab == (Object)null)
			{
				throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab"));
			fdBunkerSpiderPrefab.AddComponent<FD_BunkerSpider>();
			text = "Loot Bug";
			fdLootBugPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab");
			if ((Object)(object)fdLootBugPrefab == (Object)null)
			{
				throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab"));
			fdLootBugPrefab.AddComponent<FD_LootBug>();
			text = "Snare Flea";
			fdSnareFleaPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab");
			if ((Object)(object)fdSnareFleaPrefab == (Object)null)
			{
				throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab"));
			fdSnareFleaPrefab.AddComponent<FD_SnareFlea>();
			text = "Thumper";
			fdThumperPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab");
			if ((Object)(object)fdThumperPrefab == (Object)null)
			{
				throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab"));
			FD_Thumper fD_Thumper = fdThumperPrefab.AddComponent<FD_Thumper>();
			fD_Thumper.acEntrance = GetAudioClip(fdAudioPath + "monster sounds/thumper yell");
			fD_Thumper.acDefaultAttack = audioClip;
			text = "Nutcracker";
			fdNutcrackerPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab");
			if ((Object)(object)fdNutcrackerPrefab == (Object)null)
			{
				throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab"));
			fdNutcrackerPrefab.AddComponent<FD_Nutcracker>();
			itemPintoBoyLJ = pintoBundle.LoadAsset<Item>(basePath + "/pintoboy lj.asset");
			if ((Object)(object)itemPintoBoyLJ == (Object)null)
			{
				throw new Exception("Failed to load Pinto LJ Item!");
			}
			PintoBoy pintoBoy2 = itemPintoBoyLJ.spawnPrefab.AddComponent<LethalJumpany>();
			if ((Object)(object)pintoBoy2 == (Object)null)
			{
				throw new Exception("Failed to load Pinto Boy!");
			}
			((GrabbableObject)pintoBoy2).itemProperties = itemPintoBoyLJ;
			itemPintoBoyFD = pintoBundle.LoadAsset<Item>(basePath + "/pintoboy fd.asset");
			if ((Object)(object)itemPintoBoyFD == (Object)null)
			{
				throw new Exception("Failed to load Pinto FD Item!");
			}
			FacilityDash facilityDash = itemPintoBoyFD.spawnPrefab.AddComponent<FacilityDash>();
			if ((Object)(object)facilityDash == (Object)null)
			{
				throw new Exception("Failed to load Pinto Boy!");
			}
			((GrabbableObject)facilityDash).itemProperties = itemPintoBoyFD;
			facilityDash.prefabBracken = fdBrackenPrefab;
			facilityDash.prefabBunkerSpider = fdBunkerSpiderPrefab;
			facilityDash.prefabLootBug = fdLootBugPrefab;
			facilityDash.prefabNutcracker = fdNutcrackerPrefab;
			facilityDash.prefabSnareFlea = fdSnareFleaPrefab;
			facilityDash.prefabThumper = fdThumperPrefab;
		}

		private GameObject LoadFDPrefab(MonoBehaviour component, string prefabName)
		{
			GameObject val = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + prefabName + ".prefab");
			if ((Object)(object)val == (Object)null)
			{
				throw new Exception("Failed to load " + prefabName + " Prefab Object!");
			}
			Debug.Log((object)("PintoBoy FD: Loading " + prefabName + " Prefab. Component type is:" + ((object)component).GetType()));
			val.AddComponent(((object)component).GetType());
			return val;
		}

		private void LoadPrefabObject(GameObject prefab, MonoBehaviour component, string prefabName)
		{
			prefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + prefabName + ".prefab");
			if ((Object)(object)prefab == (Object)null)
			{
				throw new Exception("Failed to load " + prefabName + " Prefab Object!");
			}
			prefab.AddComponent(((object)component).GetType());
			if ((Object)(object)prefab == (Object)null)
			{
				throw new Exception("Failed to load " + prefabName + " Prefab!");
			}
		}

		public static AudioClip GetAudioClip(string path)
		{
			AudioClip val = pintoBundle.LoadAsset<AudioClip>(path + ".wav");
			if ((Object)(object)val == (Object)null)
			{
				val = pintoBundle.LoadAsset<AudioClip>(path + ".mp3");
			}
			if ((Object)(object)val == (Object)null)
			{
				throw new Exception("Failed to load Audio Clip " + path);
			}
			return val;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "CollectNewScrapForThisRound")]
		public static void PintoBoyAddedToShip(GrabbableObject scrapObject)
		{
			if (scrapObject is PintoBoy)
			{
				PintoBoy pintoBoy = (PintoBoy)(object)scrapObject;
				pintoBoy.MakeScreenNOTSpawnable();
				Debug.Log((object)"PintoBoy added to ship and screen not spawned");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
		public static void DespawnPintoBoyScreens(RoundManager __instance, ref bool despawnAllItems)
		{
			if (!((NetworkBehaviour)__instance).IsServer)
			{
				return;
			}
			PintoBoy[] array = Object.FindObjectsOfType<PintoBoy>();
			for (int i = 0; i < array.Length; i++)
			{
				if (despawnAllItems || (!((GrabbableObject)array[i]).isHeld && !((GrabbableObject)array[i]).isInShipRoom))
				{
					if (((GrabbableObject)array[i]).isHeld && (Object)(object)((GrabbableObject)array[i]).playerHeldBy != (Object)null)
					{
						((GrabbableObject)array[i]).playerHeldBy.DropAllHeldItemsAndSync();
					}
					NetworkObject component = ((Component)array[i]).gameObject.GetComponent<NetworkObject>();
					if ((Object)(object)component != (Object)null && component.IsSpawned)
					{
						Object.Destroy((Object)(object)array[i].cam.gameObject);
						((Component)array[i]).gameObject.GetComponent<NetworkObject>().Despawn(true);
					}
					else
					{
						Debug.Log((object)("Error/warning: prop '" + ((Object)((Component)array[i]).gameObject).name + "' was not spawned or did not have a NetworkObject component! Skipped despawning and destroyed it instead."));
						Object.Destroy((Object)(object)array[i].cam.gameObject);
						Object.Destroy((Object)(object)((Component)array[i]).gameObject);
					}
				}
				else
				{
					((GrabbableObject)array[i]).scrapPersistedThroughRounds = true;
				}
				if (__instance.spawnedSyncedObjects.Contains(((Component)array[i]).gameObject))
				{
					__instance.spawnedSyncedObjects.Remove(((Component)array[i]).gameObject);
				}
			}
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resource
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("PintoMod.Resource", typeof(Resource).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resource()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Pinto Mod";

		public const string PLUGIN_NAME = "Pinto Mod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace PintoMod.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("PintoMod.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] pintobund
		{
			get
			{
				object @object = ResourceManager.GetObject("pintobund", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace PintoMod.Assets.Scripts
{
	[HarmonyPatch(typeof(GrabbableObject))]
	public static class GrabbableObject_Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		private static void Start(GrabbableObject __instance)
		{
			if (((Object)__instance).name == "Pinto")
			{
				Debug.Log((object)"Instance is Pinto");
				PintoBoy pintoBoy = (PintoBoy)(object)__instance;
			}
		}
	}
	[HarmonyPatch]
	public class NetworkHandler
	{
		private static GameObject pintoObject;

		private static GameObject ljObject;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		private static void Init()
		{
			Debug.Log((object)"Pintoboy NetworkHandler Init starting");
			Debug.Log((object)"Pintoboy NetworkHandler Init ending");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkPrefab()
		{
			//IL_005d: 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)
			try
			{
				if (NetworkManager.Singleton.IsServer)
				{
					Debug.Log((object)"Trying to spawn PintoBoy test objs");
					pintoObject = Object.Instantiate<GameObject>(Pinto_ModBase.itemPintoBoyPrefab.spawnPrefab);
					pintoObject.GetComponent<NetworkObject>().Spawn(true);
					pintoObject.transform.position = new Vector3(3.0792f, 0.2899f, -14.6918f);
					Debug.Log((object)"PintoBoy test obj 1 hopefully spawned");
					ljObject = Object.Instantiate<GameObject>(Pinto_ModBase.itemLJCartridgePrefab.spawnPrefab);
					ljObject.GetComponent<NetworkObject>().Spawn(true);
					ljObject.transform.position = new Vector3(2.6302f, 0.2875f, -14.4498f);
					Debug.Log((object)"PintoBoy test objs hopefully spawned");
				}
			}
			catch
			{
				Pinto_ModBase.Instance.Value.logger.LogError((object)"Failed to instantiate network prefab!");
			}
		}
	}
	public abstract class PintoBoyGame : MonoBehaviour
	{
		public PintoBoy pintoBoy;

		public bool isActive;

		public bool isPaused;

		public bool isInGame;

		public bool isHoldingButton;

		public bool wasInitialized = false;

		public virtual void ButtonPress()
		{
		}

		public virtual void ButtonRelease(float timeHeld)
		{
		}

		public virtual void GameUpdate()
		{
		}

		public virtual void UnPause()
		{
		}

		public virtual void Pause()
		{
		}

		public virtual void TurnedOff()
		{
		}

		public virtual void TurnedOn()
		{
		}

		public virtual void InitializeObjects(Transform gameRoot)
		{
			Debug.Log((object)("Intiailizing PintoBoyGame: " + ((Object)this).name));
			wasInitialized = true;
		}

		public virtual void TakenOutPintoBoy()
		{
			pintoBoy = null;
			DisableChildren();
		}

		public virtual void DisableChildren()
		{
			for (int i = 0; i < ((Component)this).transform.childCount; i++)
			{
				((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(false);
			}
		}

		public virtual void EnableChildren()
		{
			for (int i = 0; i < ((Component)this).transform.childCount; i++)
			{
				((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(true);
			}
		}

		public virtual void StopSounds()
		{
			pintoBoy.StopSounds();
		}

		public void PlaySound(AudioClip clip)
		{
			pintoBoy.PlaySound(clip);
		}
	}
	public class PintoCam : MonoBehaviour
	{
		private int timeToCheck = 30;

		private float timer = 2f;

		private Collider col;

		private void Awake()
		{
			CheckColliders();
		}

		private void Update()
		{
			if (timer > 0f)
			{
				timer -= Time.deltaTime;
				return;
			}
			CheckColliders();
			timer = timeToCheck;
		}

		private void CheckColliders()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			Debug.Log((object)"PintoBoy Cam: checking if any PintoBoy Cams intersect with this one");
			Collider[] array = Physics.OverlapBox(((Component)this).transform.position, Vector3.one * 10f);
			if ((Object)(object)col == (Object)null)
			{
				col = ((Component)this).GetComponent<Collider>();
			}
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i] != (Object)(object)col)
				{
					CheckCollider(array[i]);
				}
			}
		}

		private void CheckCollider(Collider collision)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00e1: 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_00f6: 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_0038: 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_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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"PintoBoy Cam: moving to stop intersecting");
			Vector3 val;
			if (((Component)collision).transform.position.x > ((Component)this).transform.position.x)
			{
				val = Vector3.right * (-50f - Random.value);
				Debug.Log((object)("PintoBoy Cam: moving " + ((object)(Vector3)(ref val)).ToString()));
				((Component)this).transform.position = ((Component)this).transform.position + Vector3.right * (-50f - Random.value);
				CheckColliders();
			}
			else
			{
				val = Vector3.right * (50f + Random.value);
				Debug.Log((object)("PintoBoy Cam: moving " + ((object)(Vector3)(ref val)).ToString()));
				((Component)this).transform.position = ((Component)this).transform.position + Vector3.right * (50f + Random.value);
				CheckColliders();
			}
		}
	}
}
namespace PintoMod.Assets.Scripts.LethalJumpany
{
	public enum LJState
	{
		MainMenu,
		InGame,
		Paused,
		Lost
	}
	public class LethalJumpany : PintoBoy
	{
		private Animator fadeAnim;

		private LJState gameState = LJState.MainMenu;

		private Transform mainMenu;

		private Animator mainMenuAnim;

		private float mainmenuTime = 2f;

		private float mainmenuTimer = 0f;

		private float mainmenuWaitTime = 1.5f;

		private float mainmenuWaitTimer = 0f;

		private string SelectedString = "Selected";

		private string FadeString = "Fade";

		private string DoAnimString = "DoAnim";

		private Transform inGame;

		private Vector3 playerStart;

		private GameObject player;

		private Rigidbody2D playerRb;

		private Collider2D playerCol;

		private Animator playerAnim;

		private SpriteRenderer playerSprite;

		private int[] playerPositions = new int[4] { 0, 5, 10, 15 };

		private Vector3 brackenStart;

		private GameObject bracken;

		private Animator brackenAnim;

		private Collider2D groundCol;

		private Animator groundAnim;

		private string InAirString = "InAir";

		private string DeathString = "Death";

		private string ResetString = "Reset";

		public float jumpHeight = 8f;

		public float fastFallSpeed = 15f;

		public float rayCastDistance = 0.25f;

		public float rayCastOffset = -0.05f;

		private bool isGrounded = false;

		private bool doOnce = false;

		private Transform paused;

		private Transform playerSpawnpoint;

		private Transform topSpawnpoint;

		private Transform midSpawnpoint;

		private Transform bottomSpawnpoint;

		private TMP_Text scoreText;

		private TMP_Text endScreenText;

		public GameObject spiderPrefab;

		public GameObject lootbugPrefab;

		public GameObject slimePrefab;

		private float spiderSpeed = 2.5f;

		private float lootbugSpeed = 3f;

		private float slimeSpeed = 2f;

		private float spiderLootBugSpawnChance = 0.4f;

		private float spiderLootBugDistance = 2.75f;

		private float scoreIncreaseRate = 15f;

		private float increaseSpeedAddition = 0.25f;

		private float increaseAdditionRate = 100f;

		private int speedAdditionMultiplier = 1;

		private int speedAdditionMultiplierDefault = 1;

		private int timesIncreased = 0;

		private float spawnEnemyEveryMin = 40f;

		private float spawnEnemyEveryMax = 100f;

		private float lastTimeSpawned = 0f;

		private List<LJEnemy> enemies = new List<LJEnemy>();

		private bool invincible = false;

		private float invincibleTime = 2f;

		private float invincibleTimer = 0f;

		private bool dead;

		private bool deadHitGround;

		private bool deadAnimStarted;

		private bool endScreenShown;

		private float deathAnimTime = 2.5f;

		private float deathAnimTimer = 0f;

		private int deathAnimIndex = 0;

		public AudioClip acPlayerStep1;

		public AudioClip acPlayerStep2;

		public AudioClip acPlayerJump;

		public AudioClip acSnapNeck;

		public AudioClip acSnapNeckLand;

		public AudioClip acSpiderStep1;

		public AudioClip acSpiderStep2;

		public AudioClip acSpiderStep3;

		public AudioClip acSpiderStep4;

		public AudioClip acLootbugStep;

		public AudioClip acSlimeStep;

		public AudioClip acConfirm;

		public AudioClip acNewHighscore;

		public AudioClip acNoHighscore;

		public AudioClip acBackgroundSong;

		private float stepSoundTimer = 0f;

		private float stepSoundTime = 0.25f;

		private int stepSoundIndex = 0;

		private float backgroundMusicTimer = 0f;

		private float backgroundMusicTime = 0f;

		public bool jump = false;

		public Transform trGameRoot;

		private float jumpTimer = 0f;

		private float maxJumpTime = 0.5f;

		private float jumpForce = 8f;

		private bool jumping = false;

		private void Awake()
		{
			PintoAwake();
			acPlayerStep1 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "21_walk1 (player step 1)");
			acPlayerStep2 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "22_walk2 (player step 2)");
			acPlayerJump = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "23_ladder (player land)");
			acSnapNeck = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "12_exchange (snap neck)");
			acSnapNeckLand = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "67_knock (fall after neck snap)");
			acSpiderStep1 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "52_step1 (spider movement)");
			acSpiderStep2 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "53_step2 (spider movement)");
			acSpiderStep3 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "54_step3 (spider movement)");
			acSpiderStep4 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "55_step4 (spider movement)");
			acLootbugStep = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "47_grass (lootbug movement)");
			acSlimeStep = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "30_triangle (slime movement)");
			acConfirm = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "59_confirm (start game)");
			acNewHighscore = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "24_levelclear (new highscore)");
			acNoHighscore = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "64_lose2 (no highscore)");
			acBackgroundSong = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "danger_streets");
			backgroundMusicTime = acBackgroundSong.length;
			spiderPrefab = Pinto_ModBase.ljSpiderPrefab;
			lootbugPrefab = Pinto_ModBase.ljLootbugPrefab;
			slimePrefab = Pinto_ModBase.ljSlimePrefab;
			mainmenuWaitTimer = mainmenuWaitTime;
		}

		private void Update()
		{
			PintoBoyUpdate();
			if (jump)
			{
				ButtonPress();
				jump = false;
			}
		}

		public override void GameUpdate()
		{
			base.GameUpdate();
			if (fadeAnim.GetBool(DoAnimString))
			{
				fadeAnim.SetBool(DoAnimString, false);
			}
			switch (gameState)
			{
			case LJState.MainMenu:
				if (mainmenuWaitTimer > 0f)
				{
					mainmenuWaitTimer -= Time.deltaTime;
				}
				if (mainmenuTimer > 0f)
				{
					mainmenuTimer -= Time.deltaTime;
				}
				if (mainmenuTimer > 1f && !doOnce)
				{
					SetFade(FadeState.FadeOut);
					doOnce = true;
				}
				if (mainmenuTimer <= 1f && mainmenuTimer > 0f && doOnce)
				{
					mainmenuTimer = 0f;
					StartGame();
					SetFade(FadeState.FadeIn);
					doOnce = false;
				}
				break;
			case LJState.InGame:
				LJinGameUpdate();
				break;
			case LJState.Paused:
				break;
			case LJState.Lost:
				break;
			}
		}

		private void LJinGameUpdate()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_011f: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00b0: 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_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			if (endScreenShown)
			{
				return;
			}
			if (!deadAnimStarted)
			{
				RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(player.transform.position - rayCastOffset * Vector3.down), Vector2.down, rayCastDistance);
				if ((Object)(object)((RaycastHit2D)(ref val)).collider == (Object)(object)groundCol)
				{
					isGrounded = true;
					Debug.DrawRay(player.transform.position - rayCastOffset * Vector3.down, Vector2.op_Implicit(Vector2.down * rayCastDistance), Color.green);
					playerAnim.SetBool(InAirString, false);
					deadHitGround = true;
				}
				else
				{
					isGrounded = false;
					Debug.DrawRay(player.transform.position - rayCastOffset * Vector3.down, Vector2.op_Implicit(Vector2.down * rayCastDistance), Color.red);
					playerAnim.SetBool(InAirString, true);
					deadHitGround = false;
				}
			}
			if (dead)
			{
				if (deadHitGround)
				{
					PlayDeathAnim();
				}
				if (deadAnimStarted)
				{
					deathAnimTimer -= Time.deltaTime;
					if (deathAnimTimer <= 0f)
					{
						deadAnimStarted = false;
						ShowEndScreen();
					}
					else if (deathAnimTimer < deathAnimTime - 0.25f && deathAnimIndex == 0)
					{
						deathAnimIndex++;
						PlaySound(acSnapNeck);
					}
					else if (deathAnimTimer < deathAnimTime - 1.75f && deathAnimIndex == 1)
					{
						deathAnimIndex++;
						PlaySound(acSnapNeckLand);
					}
				}
				return;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				NetworkVariable<float> obj = currentScore;
				obj.Value += scoreIncreaseRate * Time.deltaTime;
			}
			if (currentScore.Value > (float)speedAdditionMultiplier * increaseAdditionRate && speedAdditionMultiplier > timesIncreased)
			{
				timesIncreased++;
				speedAdditionMultiplier++;
			}
			if (((NetworkBehaviour)this).IsOwner && currentScore.Value > lastTimeSpawned + Random.Range(spawnEnemyEveryMin, spawnEnemyEveryMax))
			{
				SpawnRandomEnemyServerRpc();
				lastTimeSpawned = currentScore.Value;
			}
			scoreText.text = Mathf.Round(currentScore.Value).ToString();
			if (player.transform.localPosition.y < playerStart.y - 0.5f || player.transform.localPosition.y > playerStart.y + 100f)
			{
				player.transform.localPosition = playerSpawnpoint.localPosition;
			}
			if (invincible)
			{
				invincibleTimer -= Time.deltaTime;
				if (invincibleTimer <= 0f)
				{
					invincible = false;
					((Renderer)playerSprite).enabled = true;
				}
				else if (invincibleTimer % 0.25f < 0.05f)
				{
					((Renderer)playerSprite).enabled = !((Renderer)playerSprite).enabled;
				}
			}
			if (health.Value > -1)
			{
				player.transform.localPosition = new Vector3(playerSpawnpoint.localPosition.x + (float)playerPositions[health.Value], player.transform.localPosition.y, 0f);
				bracken.transform.localPosition = new Vector3(playerSpawnpoint.localPosition.x - (float)(playerPositions[health.Value] * 3), brackenStart.y, 0f);
			}
			if (isGrounded && !jumping)
			{
				PlayStepSound();
				jumpTimer = 0f;
			}
			else if (isHoldingButton)
			{
				if (jumpTimer > 0f)
				{
					jumpTimer -= Time.deltaTime;
				}
			}
			else
			{
				jumpTimer = 0f;
			}
			if (backgroundMusicTimer > 0f)
			{
				backgroundMusicTimer -= Time.deltaTime;
				return;
			}
			backgroundMusicTimer = backgroundMusicTime;
			if ((Object)(object)acBackgroundSong != (Object)null)
			{
				PlaySound(acBackgroundSong);
			}
			else
			{
				Debug.Log((object)"PintoBoy LJ: acBackgroundSong is null");
			}
		}

		[ServerRpc]
		private void SpawnRandomEnemyServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1051520683u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1051520683u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				switch (Random.Range(0, 3))
				{
				case 0:
					SpawnSpider();
					break;
				case 1:
					SpawnLootbug();
					break;
				case 2:
					SpawnSlime();
					break;
				}
			}
		}

		public void SetFade(FadeState state)
		{
			switch (state)
			{
			case FadeState.FadeOff:
				fadeAnim.SetInteger(FadeString, 0);
				fadeAnim.SetBool(DoAnimString, true);
				break;
			case FadeState.FadeOn:
				fadeAnim.SetInteger(FadeString, 1);
				fadeAnim.SetBool(DoAnimString, true);
				break;
			case FadeState.FadeIn:
				fadeAnim.SetInteger(FadeString, 2);
				fadeAnim.SetBool(DoAnimString, true);
				break;
			case FadeState.FadeOut:
				fadeAnim.SetInteger(FadeString, 3);
				fadeAnim.SetBool(DoAnimString, true);
				break;
			}
		}

		public void EnableFade(bool enabled)
		{
			((Behaviour)fadeAnim).enabled = enabled;
		}

		private LJEnemy EnumToJumpanyEnemy(PintoEnemyType enemyType)
		{
			LJEnemy result = new LJEnemy();
			switch (enemyType)
			{
			case PintoEnemyType.Spider:
				result = Pinto_ModBase.ljSpiderPrefab.GetComponent<LJEnemy>();
				break;
			case PintoEnemyType.Slime:
				result = Pinto_ModBase.ljSlimePrefab.GetComponent<LJEnemy>();
				break;
			case PintoEnemyType.Lootbug:
				result = Pinto_ModBase.ljLootbugPrefab.GetComponent<LJEnemy>();
				break;
			}
			return result;
		}

		private Transform EnumToEnemySpawnPoint(PintoEnemyType enemyType)
		{
			Transform result = null;
			switch (enemyType)
			{
			case PintoEnemyType.Spider:
				result = topSpawnpoint;
				break;
			case PintoEnemyType.Lootbug:
				result = midSpawnpoint;
				break;
			case PintoEnemyType.Slime:
				result = bottomSpawnpoint;
				break;
			}
			return result;
		}

		private AudioClip[] EnumToEnemySounds(PintoEnemyType enemyType)
		{
			AudioClip[] result = null;
			switch (enemyType)
			{
			case PintoEnemyType.Spider:
				result = (AudioClip[])(object)new AudioClip[4] { acSpiderStep1, acSpiderStep2, acSpiderStep3, acSpiderStep4 };
				break;
			case PintoEnemyType.Slime:
				result = (AudioClip[])(object)new AudioClip[1] { acSlimeStep };
				break;
			case PintoEnemyType.Lootbug:
				result = (AudioClip[])(object)new AudioClip[1] { acLootbugStep };
				break;
			}
			return result;
		}

		[ServerRpc]
		private void SpawnEnemyServerRpc(float speed, string enemy)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Invalid comparison between Unknown and I4
			//IL_00a5: 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_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_00c9: 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_00ef: 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_0084: Invalid comparison between Unknown and I4
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3307819638u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives));
				bool flag = enemy != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3307819638u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Debug.Log((object)"PintoBoy LJ: Spawning enemy serverside");
				PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy);
				SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), 0f, speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType));
				SpawnEnemyClientRpc(speed, enemy);
			}
		}

		[ServerRpc]
		private void SpawnEnemyServerRpc(float speed, float distance, string enemy)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Invalid comparison between Unknown and I4
			//IL_00a5: 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_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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_010a: 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_0084: Invalid comparison between Unknown and I4
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(806374586u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives));
				bool flag = enemy != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 806374586u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Debug.Log((object)"PintoBoy LJ: Spawning enemy serverside");
				PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy);
				SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), distance, speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType));
				SpawnEnemyClientRpc(speed, enemy);
			}
		}

		[ClientRpc]
		private void SpawnEnemyClientRpc(float speed, string enemy)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007d: 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_00a3: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3997892232u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives));
				bool flag = enemy != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3997892232u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"PintoBoy LJ: Spawning enemy clientside");
				PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy);
				if (!((NetworkBehaviour)this).IsServer)
				{
					SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), 0f, speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType));
				}
			}
		}

		private LJEnemy SpawnEnemy(LJEnemy prefab, Transform position, float spawnOffset, float speed, PintoEnemyType enemy, AudioClip[] audioClips)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			LJEnemy lJEnemy = Object.Instantiate<LJEnemy>(prefab, position.position, Quaternion.identity, position);
			Transform transform = ((Component)lJEnemy).transform;
			transform.position += Vector3.right * spawnOffset;
			lJEnemy.speed = speed + increaseSpeedAddition * (float)speedAdditionMultiplier;
			lJEnemy.game = this;
			lJEnemy.onDeath.AddListener((UnityAction<LJEnemy>)OnEnemyDeath);
			lJEnemy.enemyType = enemy;
			lJEnemy.SetMovementSounds(audioClips);
			enemies.Add(lJEnemy);
			return lJEnemy;
		}

		private void OnEnemyDeath(LJEnemy enemy)
		{
			enemies.Remove(enemy);
			enemy.onDeath.RemoveListener((UnityAction<LJEnemy>)OnEnemyDeath);
			Object.Destroy((Object)(object)((Component)enemy).gameObject);
		}

		private void SpawnSpider()
		{
			SpawnEnemyServerRpc(spiderSpeed, PintoEnemyType.Spider.ToString());
		}

		private void SpawnLootbug()
		{
			SpawnEnemyServerRpc(lootbugSpeed, PintoEnemyType.Lootbug.ToString());
			if (currentScore.Value > 700f)
			{
				float value = Random.value;
				Debug.Log((object)"PintoBoy LJ: rolling for Spider after lootbug");
				if (value < spiderLootBugSpawnChance)
				{
					Debug.Log((object)"PintoBoy LJ: spider rolled");
					SpawnEnemyServerRpc(spiderSpeed, spiderLootBugDistance, PintoEnemyType.Spider.ToString());
				}
			}
		}

		private void SpawnSlime()
		{
			SpawnEnemyServerRpc(slimeSpeed, PintoEnemyType.Slime.ToString());
		}

		public override void ButtonPress()
		{
			if (!((GrabbableObject)this).isBeingUsed)
			{
				return;
			}
			switch (gameState)
			{
			case LJState.MainMenu:
				if (mainmenuWaitTimer <= 0f && mainmenuTimer <= 0f)
				{
					StartFromTitleScreen();
				}
				break;
			case LJState.InGame:
				if (dead)
				{
					if (!endScreenShown)
					{
						ShowEndScreen();
					}
					else
					{
						ShowTitleScreen();
					}
				}
				else
				{
					Jump();
				}
				break;
			case LJState.Paused:
				break;
			case LJState.Lost:
				break;
			}
		}

		private void StartFromTitleScreen()
		{
			mainMenuAnim.SetTrigger(SelectedString);
			mainmenuTimer = mainmenuTime;
			PlaySound(acConfirm);
		}

		private void ShowTitleScreen()
		{
			SwitchState(LJState.MainMenu);
			mainmenuWaitTimer = mainmenuWaitTime;
		}

		[ServerRpc]
		private void StartGameServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1034126670u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1034126670u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				StartGame();
				StartGameClientRpc();
			}
		}

		[ClientRpc]
		private void StartGameClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1479370155u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1479370155u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					StartGame();
				}
			}
		}

		private void StartGame()
		{
			SwitchState(LJState.InGame);
			playerRb.bodyType = (RigidbodyType2D)0;
			speedAdditionMultiplier = speedAdditionMultiplierDefault;
			brackenAnim.SetTrigger(ResetString);
			playerAnim.SetTrigger(ResetString);
			ClearEnemies();
			((Behaviour)groundAnim).enabled = true;
			dead = false;
			endScreenText.text = "";
			deadAnimStarted = false;
			endScreenShown = false;
			deathAnimTimer = 0f;
			if (((NetworkBehaviour)this).IsOwner)
			{
				health.Value = 3;
				currentScore.Value = 0f;
			}
			timesIncreased = 0;
			lastTimeSpawned = 0f;
			deathAnimIndex = 0;
			backgroundMusicTimer = 0f;
		}

		private void ClearEnemies()
		{
			if (enemies.Count <= 0)
			{
				return;
			}
			foreach (LJEnemy enemy in enemies)
			{
				Object.Destroy((Object)(object)((Component)enemy).gameObject);
			}
			enemies.Clear();
		}

		private void ClearEnemiesExcept(LJEnemy enemy)
		{
			if (enemies.Count <= 0)
			{
				return;
			}
			foreach (LJEnemy enemy2 in enemies)
			{
				if (!((Object)(object)enemy2 == (Object)(object)enemy))
				{
					Object.Destroy((Object)(object)((Component)enemy2).gameObject);
					enemies.Remove(enemy2);
				}
			}
		}

		[ServerRpc]
		private void SwitchStateServerRpc(LJState newState)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//IL_00a5: 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_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_00c9: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1886143849u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<LJState>(ref newState, default(ForEnums));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1886143849u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SwitchState(newState);
				SwitchStateClientRpc(newState);
			}
		}

		[ClientRpc]
		private void SwitchStateClientRpc(LJState newState)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4275040666u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<LJState>(ref newState, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4275040666u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					SwitchState(newState);
				}
			}
		}

		private void SwitchState(LJState newState)
		{
			switch (newState)
			{
			case LJState.MainMenu:
				((Component)mainMenu).gameObject.SetActive(true);
				((Component)inGame).gameObject.SetActive(false);
				((Component)paused).gameObject.SetActive(false);
				doOnce = false;
				break;
			case LJState.InGame:
				((Component)mainMenu).gameObject.SetActive(false);
				((Component)inGame).gameObject.SetActive(true);
				((Component)paused).gameObject.SetActive(false);
				break;
			case LJState.Paused:
				((Component)mainMenu).gameObject.SetActive(false);
				((Component)inGame).gameObject.SetActive(false);
				((Component)paused).gameObject.SetActive(true);
				break;
			case LJState.Lost:
				((Component)mainMenu).gameObject.SetActive(false);
				((Component)inGame).gameObject.SetActive(false);
				((Component)paused).gameObject.SetActive(false);
				break;
			}
			gameState = newState;
		}

		private void Jump()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (isGrounded)
			{
				playerRb.velocity = new Vector2(0f, jumpHeight);
				isGrounded = false;
				jumpTimer = maxJumpTime;
				jumping = true;
				PlaySound(acPlayerJump);
			}
			else
			{
				playerRb.velocity = new Vector2(0f, 0f - fastFallSpeed);
				PlaySound(acPlayerJump);
			}
		}

		public override void ButtonRelease(float timeHeld)
		{
			//IL_0007: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (playerRb.velocity.y > 0f)
			{
				playerRb.velocity = new Vector2(playerRb.velocity.x, playerRb.velocity.y / 4f);
			}
			jumping = false;
			if (!isGrounded && !(playerRb.velocity.y > 0.1f))
			{
			}
		}

		public override void TurnedOn()
		{
			EnableAllAnimators();
			ClearEnemies();
			ShowTitleScreen();
		}

		public override void ResetGame()
		{
			base.ResetGame();
		}

		private void EnableAllAnimators()
		{
			((Behaviour)groundAnim).enabled = true;
			((Behaviour)brackenAnim).enabled = true;
			((Behaviour)mainMenuAnim).enabled = true;
			((Behaviour)playerAnim).enabled = true;
			EnableFade(enabled: true);
			for (int i = 0; i < enemies.Count; i++)
			{
				((Behaviour)enemies[i].animator).enabled = true;
				enemies[i].paused = true;
			}
		}

		private void DisableAllAnimators()
		{
			((Behaviour)groundAnim).enabled = false;
			((Behaviour)brackenAnim).enabled = false;
			((Behaviour)mainMenuAnim).enabled = false;
			((Behaviour)playerAnim).enabled = false;
			EnableFade(enabled: false);
			for (int i = 0; i < enemies.Count; i++)
			{
				((Behaviour)enemies[i].animator).enabled = false;
				enemies[i].paused = false;
			}
		}

		public void PlayerGotHit()
		{
			if (((NetworkBehaviour)this).IsOwner && !invincible)
			{
				NetworkVariable<int> obj = health;
				int value = obj.Value;
				obj.Value = value - 1;
				if (health.Value <= 0)
				{
					DieServerRpc();
					return;
				}
				invincible = true;
				invincibleTimer = invincibleTime;
			}
		}

		[ServerRpc]
		public void DieServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1600077284u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1600077284u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Die();
				DieClientRpc();
			}
		}

		[ClientRpc]
		public void DieClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1025572591u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1025572591u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Die();
				}
			}
		}

		public void Die()
		{
			//IL_004e: 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_008a: 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_00bb: 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)
			((Behaviour)groundAnim).enabled = false;
			dead = true;
			for (int i = 0; i < enemies.Count; i++)
			{
				enemies[i].killedPlayer = true;
			}
			if (Mathf.Abs(player.transform.localPosition.x - playerSpawnpoint.localPosition.x) < 5f)
			{
				playerRb.velocity = new Vector2(0f, 0f);
				player.transform.localPosition = new Vector3(player.transform.localPosition.x, playerSpawnpoint.localPosition.y, 0f);
			}
		}

		public void PlayDeathAnim()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			player.transform.localPosition = playerSpawnpoint.localPosition;
			brackenAnim.SetTrigger(DeathString);
			playerAnim.SetTrigger(DeathString);
			deathAnimTimer = deathAnimTime;
			deadAnimStarted = true;
			deadHitGround = false;
			deathAnimIndex = 0;
			StopSounds();
		}

		private void ShowEndScreen()
		{
			if (currentScore.Value > highScore.Value)
			{
				endScreenText.text = "New Best!\n" + $"{Mathf.Round(currentScore.Value)}\n" + "Last Best\n" + $"{Mathf.Round(highScore.Value)}";
				if (((NetworkBehaviour)this).IsOwner)
				{
					highScore.Value = currentScore.Value;
				}
				PlaySound(acNewHighscore);
			}
			else
			{
				endScreenText.text = "Score\n" + $"{Mathf.Round(currentScore.Value)}\n" + "Best\n" + $"{Mathf.Round(highScore.Value)}";
				PlaySound(acNoHighsco