Decompiled source of Evil Pot v1.0.0

ClassLibrary4.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClassLibrary4")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary4")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("43afb890-208d-4528-aedf-46e3838ce5a8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.gemini.foddy.adaptive", "Adaptive Shadow", "1.0.0")]
public class AdaptiveShadow : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <LoadShadowSounds>d__13 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public AdaptiveShadow <>4__this;

		private string <pluginsPath>5__1;

		private string[] <targetFiles>5__2;

		private int <i>5__3;

		private string[] <foundPaths>5__4;

		private string <fullPath>5__5;

		private UnityWebRequest <uwr>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <LoadShadowSounds>d__13(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || num == 1)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<pluginsPath>5__1 = null;
			<targetFiles>5__2 = null;
			<foundPaths>5__4 = null;
			<fullPath>5__5 = null;
			<uwr>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Invalid comparison between Unknown and I4
			try
			{
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -3;
					if ((int)<uwr>5__6.result == 1)
					{
						<>4__this.shadowSounds[<i>5__3] = DownloadHandlerAudioClip.GetContent(<uwr>5__6);
						((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Found and loaded: " + <targetFiles>5__2[<i>5__3] + " from " + <foundPaths>5__4[0]));
					}
					<>m__Finally1();
					<uwr>5__6 = null;
					<fullPath>5__5 = null;
					goto IL_01b7;
				}
				<>1__state = -1;
				<pluginsPath>5__1 = Paths.PluginPath;
				<targetFiles>5__2 = new string[4] { "1.wav", "2.wav", "3.wav", "4.wav" };
				<>4__this.shadowSounds = (AudioClip[])(object)new AudioClip[4];
				<i>5__3 = 0;
				goto IL_01d1;
				IL_01b7:
				<foundPaths>5__4 = null;
				<i>5__3++;
				goto IL_01d1;
				IL_01d1:
				if (<i>5__3 < <targetFiles>5__2.Length)
				{
					<foundPaths>5__4 = Directory.GetFiles(<pluginsPath>5__1, <targetFiles>5__2[<i>5__3], SearchOption.AllDirectories);
					if (<foundPaths>5__4.Length != 0)
					{
						<fullPath>5__5 = "file://" + <foundPaths>5__4[0];
						<uwr>5__6 = UnityWebRequestMultimedia.GetAudioClip(<fullPath>5__5, (AudioType)20);
						<>1__state = -3;
						<>2__current = <uwr>5__6.SendWebRequest();
						<>1__state = 1;
						return true;
					}
					((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)("Could not find " + <targetFiles>5__2[<i>5__3] + " anywhere in the plugins folder!"));
					goto IL_01b7;
				}
				return false;
			}
			catch
			{
				//try-fault
				((IDisposable)this).Dispose();
				throw;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<uwr>5__6 != null)
			{
				((IDisposable)<uwr>5__6).Dispose();
			}
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ResetSequence>d__20 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public AdaptiveShadow <>4__this;

		private Rigidbody2D[] <>s__1;

		private int <>s__2;

		private Rigidbody2D <rb>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ResetSequence>d__20(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>s__1 = null;
			<rb>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0045: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.isRestarting = true;
				<>4__this.player.transform.position = <>4__this.resetPos;
				<>s__1 = <>4__this.player.GetComponentsInChildren<Rigidbody2D>();
				for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
				{
					<rb>5__3 = <>s__1[<>s__2];
					<rb>5__3.velocity = Vector2.zero;
					<rb>5__3.angularVelocity = 0f;
					((Component)<rb>5__3).transform.position = <>4__this.resetPos;
					<rb>5__3 = null;
				}
				<>s__1 = null;
				<>4__this.player.SendMessage("Save", (SendMessageOptions)1);
				if ((Object)(object)<>4__this.stalker != (Object)null)
				{
					Object.Destroy((Object)(object)<>4__this.stalker);
				}
				<>4__this.stalker = null;
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.isRestarting = false;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SpawnSequence>d__16 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public AdaptiveShadow <>4__this;

		private string[] <scripts>5__1;

		private string[] <>s__2;

		private int <>s__3;

		private string <s>5__4;

		private Component <c>5__5;

		private Camera[] <>s__6;

		private int <>s__7;

		private Camera <c>5__8;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SpawnSequence>d__16(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<scripts>5__1 = null;
			<>s__2 = null;
			<s>5__4 = null;
			<c>5__5 = null;
			<>s__6 = null;
			<c>5__8 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.isRestarting = true;
				<>2__current = (object)new WaitForSeconds(7f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if ((Object)(object)<>4__this.player == (Object)null)
				{
					<>4__this.isRestarting = false;
					return false;
				}
				<>4__this.stalker = Object.Instantiate<GameObject>(<>4__this.player);
				((Object)<>4__this.stalker).name = "ADAPTIVE_SHADOW";
				<>4__this.stalker.transform.position = <>4__this.playerSpawnPoint;
				<scripts>5__1 = new string[5] { "PlayerControl", "PlayerSounds", "Saviour", "Screener", "RisingTide" };
				<>s__2 = <scripts>5__1;
				for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++)
				{
					<s>5__4 = <>s__2[<>s__3];
					<c>5__5 = <>4__this.stalker.GetComponent(<s>5__4);
					if ((Object)(object)<c>5__5 != (Object)null)
					{
						Object.Destroy((Object)(object)<c>5__5);
					}
					<c>5__5 = null;
					<s>5__4 = null;
				}
				<>s__2 = null;
				<>s__6 = <>4__this.stalker.GetComponentsInChildren<Camera>();
				for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++)
				{
					<c>5__8 = <>s__6[<>s__7];
					Object.Destroy((Object)(object)<c>5__8);
					<c>5__8 = null;
				}
				<>s__6 = null;
				<>4__this.stalker.AddComponent<AdaptiveBrain>().Setup(<>4__this.player.transform, <>4__this);
				<>4__this.SetupPhysicsAndVisuals();
				<>4__this.isRestarting = false;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private Vector3 playerSpawnPoint;

	private bool hasCapturedSpawn = false;

	private float safeTimeRemaining = 0f;

	private AudioClip[] shadowSounds = (AudioClip[])(object)new AudioClip[3];

	private AudioSource audioSource;

	private float soundTimer = 10f;

	private GameObject player;

	private GameObject stalker;

	private bool isRestarting = false;

	private readonly Vector3 resetPos = new Vector3(-43.7f, -1.6f, 0f);

	private void Awake()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
		((MonoBehaviour)this).StartCoroutine(LoadShadowSounds());
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		stalker = null;
		player = null;
		isRestarting = false;
		safeTimeRemaining = 0f;
	}

	private void Update()
	{
		//IL_00a0: 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)
		if (safeTimeRemaining > 0f)
		{
			safeTimeRemaining -= Time.deltaTime;
		}
		if ((Object)(object)player == (Object)null)
		{
			player = GameObject.Find("Player");
			return;
		}
		if ((Object)(object)stalker == (Object)null && !isRestarting)
		{
			((MonoBehaviour)this).StartCoroutine(SpawnSequence());
		}
		if ((Object)(object)player != (Object)null && !hasCapturedSpawn)
		{
			playerSpawnPoint = player.transform.position;
			hasCapturedSpawn = true;
		}
		if ((Object)(object)stalker != (Object)null)
		{
			soundTimer -= Time.deltaTime;
			if (soundTimer <= 0f)
			{
				PlayRandomSound();
				soundTimer = Random.Range(7f, 11f);
			}
		}
	}

	[IteratorStateMachine(typeof(<LoadShadowSounds>d__13))]
	private IEnumerator LoadShadowSounds()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <LoadShadowSounds>d__13(0)
		{
			<>4__this = this
		};
	}

	private void PlayRandomSound()
	{
		if (!((Object)(object)stalker == (Object)null) && shadowSounds != null)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				audioSource = stalker.AddComponent<AudioSource>();
				audioSource.spatialBlend = 1f;
				audioSource.minDistance = 2f;
				audioSource.maxDistance = 20f;
				audioSource.volume = 100f;
			}
			int num = Random.Range(0, 4);
			if ((Object)(object)shadowSounds[num] != (Object)null)
			{
				audioSource.PlayOneShot(shadowSounds[num]);
			}
		}
	}

	public void StartSafeWindow(float duration)
	{
		safeTimeRemaining = duration;
	}

	[IteratorStateMachine(typeof(<SpawnSequence>d__16))]
	private IEnumerator SpawnSequence()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SpawnSequence>d__16(0)
		{
			<>4__this = this
		};
	}

	private void SetupPhysicsAndVisuals()
	{
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		stalker.layer = 2;
		Transform[] componentsInChildren = stalker.GetComponentsInChildren<Transform>();
		foreach (Transform val in componentsInChildren)
		{
			((Component)val).gameObject.layer = 2;
		}
		Renderer[] componentsInChildren2 = stalker.GetComponentsInChildren<Renderer>();
		foreach (Renderer val2 in componentsInChildren2)
		{
			val2.material.color = new Color(0.05f, 0.05f, 0.1f);
		}
		Collider2D[] componentsInChildren3 = player.GetComponentsInChildren<Collider2D>();
		Collider2D[] componentsInChildren4 = stalker.GetComponentsInChildren<Collider2D>();
		foreach (Collider2D val3 in componentsInChildren4)
		{
			Collider2D[] array = componentsInChildren3;
			foreach (Collider2D val4 in array)
			{
				Physics2D.IgnoreCollision(val3, val4, true);
			}
			if (((Object)val3).name == "Tip" || ((Object)val3).name == "PotCollider")
			{
				PolygonCollider2D val5 = ((Component)val3).gameObject.AddComponent<PolygonCollider2D>();
				((Collider2D)val5).isTrigger = true;
				ShadowHitbox shadowHitbox = ((Component)val3).gameObject.AddComponent<ShadowHitbox>();
				shadowHitbox.master = this;
			}
		}
	}

	public bool IsSafe()
	{
		return safeTimeRemaining > 0f;
	}

	public void TriggerReset()
	{
		if (!isRestarting && !IsSafe())
		{
			((MonoBehaviour)this).StartCoroutine(ResetSequence());
		}
	}

	[IteratorStateMachine(typeof(<ResetSequence>d__20))]
	private IEnumerator ResetSequence()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ResetSequence>d__20(0)
		{
			<>4__this = this
		};
	}
}
public class AdaptiveBrain : MonoBehaviour
{
	private class SpatialMove
	{
		public float angle;

		public float extension;

		public float terrainSlope;

		public float distanceToWall;
	}

	private Transform player;

	private AdaptiveShadow master;

	private HingeJoint2D hinge;

	private SliderJoint2D slider;

	private Rigidbody2D potRB;

	private Vector3 lastPos;

	private float stuckTimer = 0f;

	private bool isExecutingRecovery = false;

	private SpatialMove recoveryMove = null;

	private List<SpatialMove> moveBrain = new List<SpatialMove>();

	private Transform playerHub;

	private SliderJoint2D playerSlider;

	private Rigidbody2D playerRB;

	private float distanceTimer = 0f;

	private List<float> learnedAngles = new List<float>();

	private float styleExtension = 0.5f;

	private float aggression = 1000f;

	public void Setup(Transform p, AdaptiveShadow m)
	{
		player = p;
		master = m;
		hinge = ((IEnumerable<HingeJoint2D>)((Component)this).GetComponentsInChildren<HingeJoint2D>()).FirstOrDefault((Func<HingeJoint2D, bool>)((HingeJoint2D t) => ((Object)t).name == "Hub"));
		slider = ((Component)this).GetComponentInChildren<SliderJoint2D>();
		potRB = ((Component)this).GetComponent<Rigidbody2D>();
		playerRB = ((Component)player).GetComponent<Rigidbody2D>();
		playerSlider = ((Component)player).GetComponentInChildren<SliderJoint2D>();
		playerHub = ((IEnumerable<Transform>)((Component)player).GetComponentsInChildren<Transform>()).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "Hub"));
	}

	private void FixedUpdate()
	{
		//IL_0042: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)player == (Object)null || (Object)(object)hinge == (Object)null || (Object)(object)slider == (Object)null)
		{
			return;
		}
		ObservePlayer();
		if (Vector3.Distance(((Component)this).transform.position, lastPos) < 0.3f)
		{
			stuckTimer += Time.fixedDeltaTime;
		}
		else
		{
			stuckTimer = 0f;
			isExecutingRecovery = false;
			lastPos = ((Component)this).transform.position;
		}
		if (Vector3.Distance(((Component)this).transform.position, player.position) > 16f)
		{
			distanceTimer += Time.fixedDeltaTime;
			if (distanceTimer > 3f)
			{
				TrySafeTeleport();
				distanceTimer = 0f;
			}
		}
		else
		{
			distanceTimer = 0f;
		}
		ImproviseMovement();
	}

	private void TrySafeTeleport()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_0085: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)this).transform.position - player.position;
		Vector3 val2 = ((Vector3)(ref val)).normalized;
		if (val2 == Vector3.zero)
		{
			val2 = Vector3.left;
		}
		for (int i = 0; i < 8; i++)
		{
			float num = (float)i * 45f;
			Vector3 val3 = Quaternion.Euler(0f, 0f, num) * val2;
			Vector3 val4 = player.position + val3 * 6f;
			Collider2D val5 = Physics2D.OverlapCircle(Vector2.op_Implicit(val4), 3f, LayerMask.GetMask(new string[2] { "Ground", "Default" }));
			if ((Object)(object)val5 == (Object)null)
			{
				ApplyTeleport(val4);
				return;
			}
		}
		ApplyTeleport(player.position + Vector3.up * 6f);
	}

	private void ApplyTeleport(Vector3 targetPos)
	{
		//IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = targetPos - ((Component)this).transform.position;
		Rigidbody2D[] componentsInChildren = ((Component)this).GetComponentsInChildren<Rigidbody2D>();
		foreach (Rigidbody2D val2 in componentsInChildren)
		{
			val2.position += Vector2.op_Implicit(val);
			val2.velocity = Vector2.zero;
			val2.angularVelocity = 0f;
		}
		master.StartSafeWindow(1f);
		distanceTimer = 0f;
		stuckTimer = 0f;
	}

	private void ObservePlayer()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)playerRB == (Object)null || (Object)(object)playerHub == (Object)null)
		{
			return;
		}
		Vector2 velocity = playerRB.velocity;
		Vector2 normalized = ((Vector2)(ref velocity)).normalized;
		RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(player.position), normalized, 3f);
		if (playerRB.velocity.y > 1.5f && (Object)(object)((RaycastHit2D)(ref val)).collider != (Object)null)
		{
			float terrainSlope = Vector2.Angle(((RaycastHit2D)(ref val)).normal, Vector2.up);
			moveBrain.Add(new SpatialMove
			{
				angle = playerHub.localEulerAngles.z,
				extension = playerSlider.jointTranslation,
				terrainSlope = terrainSlope,
				distanceToWall = ((RaycastHit2D)(ref val)).distance
			});
			if (moveBrain.Count > 500)
			{
				moveBrain.RemoveAt(0);
			}
		}
		if ((Object)(object)playerSlider != (Object)null)
		{
			styleExtension = Mathf.Lerp(styleExtension, playerSlider.jointTranslation, 0.05f);
		}
	}

	private void ExecuteRecovery(ref JointMotor2D hm, ref JointMotor2D sm, float dir)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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_00d2: 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)
		if (!isExecutingRecovery)
		{
			RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(((Component)this).transform.position), Vector2.right * dir, 2.5f);
			float currentSlope = (((Object)(object)((RaycastHit2D)(ref val)).collider != (Object)null) ? Vector2.Angle(((RaycastHit2D)(ref val)).normal, Vector2.up) : 0f);
			recoveryMove = (from m in moveBrain
				where Mathf.Abs(m.terrainSlope - currentSlope) < 20f
				orderby Random.value
				select m).FirstOrDefault();
			isExecutingRecovery = true;
		}
		if (recoveryMove != null)
		{
			float num = Mathf.DeltaAngle(((Component)hinge).transform.localEulerAngles.z, recoveryMove.angle);
			((JointMotor2D)(ref hm)).motorSpeed = num * 40f;
			((JointMotor2D)(ref sm)).motorSpeed = (recoveryMove.extension - slider.jointTranslation) * 30f;
		}
	}

	private void ImproviseMovement()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Vector2.op_Implicit(player.position - ((Component)this).transform.position);
		float num = Mathf.Sign(val.x);
		Vector2 velocity = potRB.velocity;
		float magnitude = ((Vector2)(ref velocity)).magnitude;
		hinge.useMotor = true;
		slider.useMotor = true;
		JointMotor2D hm = hinge.motor;
		JointMotor2D sm = slider.motor;
		((JointMotor2D)(ref hm)).maxMotorTorque = 15000f;
		((JointMotor2D)(ref sm)).maxMotorTorque = 15000f;
		if (stuckTimer > 1f && moveBrain.Count > 10)
		{
			ExecuteRecovery(ref hm, ref sm, num);
		}
		else if (magnitude > 5f)
		{
			isExecutingRecovery = false;
			((JointMotor2D)(ref hm)).motorSpeed = (0f - aggression) * num;
			((JointMotor2D)(ref sm)).motorSpeed = 0f;
		}
		else
		{
			isExecutingRecovery = false;
			((JointMotor2D)(ref hm)).motorSpeed = (0f - aggression) * num;
			((JointMotor2D)(ref sm)).motorSpeed = (styleExtension - slider.jointTranslation) * 30f;
		}
		aggression = Mathf.Lerp(aggression, (((Vector2)(ref val)).magnitude > 3f) ? 1500f : 900f, 0.1f);
		hinge.motor = hm;
		slider.motor = sm;
	}
}
public class ShadowHitbox : MonoBehaviour
{
	public AdaptiveShadow master;

	private void OnTriggerEnter2D(Collider2D col)
	{
		if (((Object)((Component)col).transform.root).name == "Player")
		{
			master.TriggerReset();
		}
	}
}