Decompiled source of RexClimb v1.0.1

RexClimb.dll

Decompiled 19 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RexClimb")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RexClimb")]
[assembly: AssemblyTitle("RexClimb")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RexClimb;

public static class ClimbDebug
{
	public static bool VisualsEnabled = true;

	public static bool ForceParticles = true;

	public static bool ForceSound = true;

	public static bool FloorAlign = true;

	public static bool Flip = false;

	public static int SpinSteps = 3;

	public static float WallOffset = 0.4f;

	public static float RootsLift = 0.9f;

	public static int RootsAngle = 2;

	public static bool DumpRequested = false;
}
[BepInPlugin("Quibibly.rexclimb", "RexClimb", "0.8.1")]
public class RexClimbPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RexClimb 0.8.1 loaded. Keys: F1/F2 vine lift, F12 vine angle, F3 floor tilt, F4 particles, F5 visuals, F6 flip, F7 spin, F8/F9 offset, F10 dump, F11 sound");
		CharacterBody.onBodyStartGlobal += OnBodyStart;
	}

	private void OnDestroy()
	{
		CharacterBody.onBodyStartGlobal -= OnBodyStart;
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)282))
		{
			ClimbDebug.RootsLift -= 0.1f;
			Debug.Log((object)("[RexClimb] RootsLift: " + ClimbDebug.RootsLift.ToString("F1")));
		}
		if (Input.GetKeyDown((KeyCode)283))
		{
			ClimbDebug.RootsLift += 0.1f;
			Debug.Log((object)("[RexClimb] RootsLift: " + ClimbDebug.RootsLift.ToString("F1")));
		}
		if (Input.GetKeyDown((KeyCode)293))
		{
			ClimbDebug.RootsAngle = (ClimbDebug.RootsAngle + 1) % 4;
			Debug.Log((object)("[RexClimb] RootsAngle: " + ClimbDebug.RootsAngle));
		}
		if (Input.GetKeyDown((KeyCode)284))
		{
			ClimbDebug.FloorAlign = !ClimbDebug.FloorAlign;
			Debug.Log((object)("[RexClimb] Tilt model to the floor (game default is True): " + ClimbDebug.FloorAlign));
		}
		if (Input.GetKeyDown((KeyCode)285))
		{
			ClimbDebug.ForceParticles = !ClimbDebug.ForceParticles;
			Debug.Log((object)("[RexClimb] Force particles: " + ClimbDebug.ForceParticles));
		}
		if (Input.GetKeyDown((KeyCode)286))
		{
			ClimbDebug.VisualsEnabled = !ClimbDebug.VisualsEnabled;
			Debug.Log((object)("[RexClimb] Visuals enabled: " + ClimbDebug.VisualsEnabled));
		}
		if (Input.GetKeyDown((KeyCode)287))
		{
			ClimbDebug.Flip = !ClimbDebug.Flip;
			Debug.Log((object)("[RexClimb] Flip: " + ClimbDebug.Flip));
		}
		if (Input.GetKeyDown((KeyCode)288))
		{
			ClimbDebug.SpinSteps = (ClimbDebug.SpinSteps + 1) % 4;
			Debug.Log((object)("[RexClimb] Spin: " + ClimbDebug.SpinSteps * 90 + " degrees"));
		}
		if (Input.GetKeyDown((KeyCode)289))
		{
			ClimbDebug.WallOffset -= 0.1f;
			Debug.Log((object)("[RexClimb] WallOffset: " + ClimbDebug.WallOffset.ToString("F1")));
		}
		if (Input.GetKeyDown((KeyCode)290))
		{
			ClimbDebug.WallOffset += 0.1f;
			Debug.Log((object)("[RexClimb] WallOffset: " + ClimbDebug.WallOffset.ToString("F1")));
		}
		if (Input.GetKeyDown((KeyCode)291))
		{
			ClimbDebug.DumpRequested = true;
		}
		if (Input.GetKeyDown((KeyCode)292))
		{
			ClimbDebug.ForceSound = !ClimbDebug.ForceSound;
			Debug.Log((object)("[RexClimb] Climb sound: " + ClimbDebug.ForceSound));
		}
	}

	private void OnBodyStart(CharacterBody body)
	{
		if (((Object)body).name.StartsWith("TreebotBody") && (Object)(object)((Component)body).GetComponent<RexClimbBehavior>() == (Object)null)
		{
			((Component)body).gameObject.AddComponent<RexClimbBehavior>();
			((Component)body).gameObject.AddComponent<RexClimbVisuals>();
			Debug.Log((object)"[RexClimb] Attached to REX");
		}
	}
}
public class RexClimbBehavior : MonoBehaviour
{
	private const float CheckDistance = 2f;

	private const float CheckRadius = 0.35f;

	private const float MinWallAngle = 50f;

	private const float MaxWallAngle = 100f;

	private const float ClimbSpeedMultiplier = 1f;

	private const float LateralSpeedMultiplier = 0.8f;

	private const float HoldBias = 0.5f;

	private const float StickSpeed = 2f;

	private const float GraceDistance = 0.8f;

	private const float MinGraceTime = 0.06f;

	private const float MaxGraceTime = 0.3f;

	private const float VisualGraceTime = 0.05f;

	private const float LedgeUpSpeed = 4f;

	private const float LedgeMaxForwardSpeed = 10f;

	private const float JumpOffSpeed = 12f;

	private const float JumpOffUpSpeed = 14f;

	private const float ReattachDelay = 0.4f;

	private const float NormalSmoothing = 12f;

	private const float BlockedProgressFraction = 0.2f;

	private const float BlockedTime = 0.4f;

	private const float BlockedReattachDelay = 0.6f;

	private static readonly float[] ProbeHeights = new float[3] { -0.6f, 0f, 0.6f };

	private CharacterBody body;

	private CharacterMotor motor;

	private bool isClimbing;

	private Vector3 wallNormal;

	private float timeSinceWall;

	private float reattachTimer;

	private float slopeLogTimer;

	private float lastLoggedSlope = -100f;

	private Vector3 lastPos;

	private bool hasLastPos;

	private float blockedTimer;

	private float lastUpFactor;

	private float lastCommandSpeed;

	private Vector3 lastCommandDir;

	private const float RemoteStartUpSpeed = 2f;

	private const float RemoteStartTime = 0.15f;

	private const float RemoteLostWallTime = 0.2f;

	private const float RemoteFallSpeedFactor = 1.3f;

	private Vector3 remoteLastPos;

	private bool remoteHasPos;

	private Vector3 remoteVel;

	private float remoteCandidateTimer;

	private float remoteNotSprintTimer;

	private const float RemoteStopSprintTime = 0.25f;

	public bool IsClimbing => isClimbing;

	public Vector3 WallNormal => wallNormal;

	public bool WallContact
	{
		get
		{
			if (isClimbing)
			{
				return timeSinceWall < 0.05f;
			}
			return false;
		}
	}

	private float GraceTime
	{
		get
		{
			float num = Mathf.Max(body.moveSpeed * 1f, 1f);
			return Mathf.Clamp(0.8f / num, 0.06f, 0.3f);
		}
	}

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
	}

	private void OnDisable()
	{
		isClimbing = false;
	}

	private bool ProbeWall(Vector3 dir, out Vector3 normal, out float shallowAngle)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0020: 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_002d: 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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: 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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: 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_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)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		normal = Vector3.zero;
		shallowAngle = 0f;
		Vector3 val = Vector3.zero;
		int num = 0;
		Vector3 position = ((Component)this).transform.position;
		RaycastHit val2 = default(RaycastHit);
		for (int i = 0; i < ProbeHeights.Length; i++)
		{
			if (Physics.SphereCast(position + Vector3.up * ProbeHeights[i] - dir * 0.3f, 0.35f, dir, ref val2, 2.3f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				float num2 = Vector3.Angle(((RaycastHit)(ref val2)).normal, Vector3.up);
				if (num2 >= 50f && num2 <= 100f)
				{
					val += ((RaycastHit)(ref val2)).normal;
					num++;
				}
				else if (num2 < 50f && num2 > shallowAngle)
				{
					shallowAngle = num2;
				}
			}
		}
		if (num == 0 || ((Vector3)(ref val)).sqrMagnitude < 0.001f)
		{
			return false;
		}
		normal = ((Vector3)(ref val)).normalized;
		return true;
	}

	private void FixedUpdate()
	{
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)body))
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)motor))
		{
			motor = body.characterMotor;
		}
		if (!body.hasEffectiveAuthority)
		{
			InferRemote();
		}
		else
		{
			if (!Object.op_Implicit((Object)(object)motor) || !Object.op_Implicit((Object)(object)body.inputBank))
			{
				return;
			}
			float fixedDeltaTime = Time.fixedDeltaTime;
			if (reattachTimer > 0f)
			{
				reattachTimer -= fixedDeltaTime;
			}
			if (slopeLogTimer > 0f)
			{
				slopeLogTimer -= fixedDeltaTime;
			}
			bool flag = body.isSprinting && ((Vector3)(ref body.inputBank.moveVector)).sqrMagnitude > 0.01f;
			bool flag2 = false;
			Vector3 normal = Vector3.zero;
			float shallowAngle = 0f;
			if (flag && (isClimbing || reattachTimer <= 0f))
			{
				if (isClimbing)
				{
					flag2 = ProbeWall(-wallNormal, out normal, out shallowAngle);
					if (!flag2)
					{
						Vector3 val = -wallNormal;
						val.y = 0f;
						if (((Vector3)(ref val)).sqrMagnitude > 0.001f)
						{
							flag2 = ProbeWall(((Vector3)(ref val)).normalized, out normal, out shallowAngle);
						}
					}
				}
				else
				{
					Vector3 val2 = body.inputBank.moveVector;
					val2.y = 0f;
					if (((Vector3)(ref val2)).sqrMagnitude < 0.001f)
					{
						val2 = body.inputBank.aimDirection;
						val2.y = 0f;
					}
					if (((Vector3)(ref val2)).sqrMagnitude > 0.001f)
					{
						flag2 = ProbeWall(((Vector3)(ref val2)).normalized, out normal, out shallowAngle);
					}
				}
			}
			if (flag2)
			{
				if (isClimbing)
				{
					Vector3 val3 = Vector3.Slerp(wallNormal, normal, 1f - Mathf.Exp(-12f * fixedDeltaTime));
					wallNormal = ((Vector3)(ref val3)).normalized;
				}
				else
				{
					wallNormal = normal;
				}
			}
			if (!flag2 && !isClimbing && flag && shallowAngle > 30f && slopeLogTimer <= 0f && Mathf.Abs(shallowAngle - lastLoggedSlope) > 5f)
			{
				Debug.Log((object)("[RexClimb] Sprinting into a surface that is too shallow to climb. Angle: " + shallowAngle.ToString("F0")));
				lastLoggedSlope = shallowAngle;
				slopeLogTimer = 0.5f;
			}
			if (flag2)
			{
				timeSinceWall = 0f;
			}
			else
			{
				timeSinceWall += fixedDeltaTime;
			}
			if (!isClimbing)
			{
				if (flag2)
				{
					StartClimb();
				}
			}
			else if (!flag)
			{
				StopClimb(lostWall: false);
			}
			else if (((ButtonState)(ref body.inputBank.jump)).justPressed)
			{
				JumpOff();
			}
			else if (timeSinceWall > GraceTime)
			{
				StopClimb(lostWall: true);
			}
			if (isClimbing)
			{
				if (hasLastPos && lastCommandSpeed > 1f)
				{
					float num = Vector3.Dot(((Component)this).transform.position - lastPos, lastCommandDir);
					float num2 = lastCommandSpeed * fixedDeltaTime;
					if (num < num2 * 0.2f)
					{
						blockedTimer += fixedDeltaTime;
					}
					else
					{
						blockedTimer = Mathf.Max(0f, blockedTimer - fixedDeltaTime * 2f);
					}
				}
				else
				{
					blockedTimer = Mathf.Max(0f, blockedTimer - fixedDeltaTime * 2f);
				}
				lastPos = ((Component)this).transform.position;
				hasLastPos = true;
				if (blockedTimer > 0.4f)
				{
					ReleaseBlocked();
				}
				else
				{
					ApplyClimb();
				}
			}
			else
			{
				hasLastPos = false;
				blockedTimer = 0f;
			}
		}
	}

	private void InferRemote()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: 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_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0037: 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_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		float fixedDeltaTime = Time.fixedDeltaTime;
		if (fixedDeltaTime <= 0f)
		{
			return;
		}
		Vector3 position = ((Component)this).transform.position;
		if (remoteHasPos)
		{
			remoteVel = Vector3.Lerp(remoteVel, (position - remoteLastPos) / fixedDeltaTime, 0.3f);
		}
		remoteLastPos = position;
		remoteHasPos = true;
		bool flag = Object.op_Implicit((Object)(object)motor) && motor.isGrounded;
		if (!isClimbing)
		{
			if (flag || !body.isSprinting || remoteVel.y < 2f)
			{
				remoteCandidateTimer = 0f;
				return;
			}
			Vector3 val = Vector3.zero;
			if (Object.op_Implicit((Object)(object)body.inputBank))
			{
				val = body.inputBank.moveVector;
				val.y = 0f;
				if (((Vector3)(ref val)).sqrMagnitude < 0.001f)
				{
					val = body.inputBank.aimDirection;
					val.y = 0f;
				}
			}
			if (((Vector3)(ref val)).sqrMagnitude < 0.001f)
			{
				val = ((Component)this).transform.forward;
				val.y = 0f;
			}
			if (((Vector3)(ref val)).sqrMagnitude < 0.001f || !ProbeWall(((Vector3)(ref val)).normalized, out var normal, out var _))
			{
				remoteCandidateTimer = 0f;
				return;
			}
			remoteCandidateTimer += fixedDeltaTime;
			wallNormal = normal;
			if (remoteCandidateTimer >= 0.15f)
			{
				isClimbing = true;
				timeSinceWall = 0f;
				remoteCandidateTimer = 0f;
				remoteNotSprintTimer = 0f;
				Debug.Log((object)("[RexClimb] Remote REX climb inferred (isSprinting=" + body.isSprinting + ")"));
			}
			return;
		}
		Vector3 normal2;
		float shallowAngle2;
		bool flag2 = ProbeWall(-wallNormal, out normal2, out shallowAngle2);
		if (!flag2)
		{
			Vector3 val2 = -wallNormal;
			val2.y = 0f;
			if (((Vector3)(ref val2)).sqrMagnitude > 0.001f)
			{
				flag2 = ProbeWall(((Vector3)(ref val2)).normalized, out normal2, out shallowAngle2);
			}
		}
		if (flag2)
		{
			Vector3 val3 = Vector3.Slerp(wallNormal, normal2, 1f - Mathf.Exp(-12f * fixedDeltaTime));
			wallNormal = ((Vector3)(ref val3)).normalized;
			timeSinceWall = 0f;
		}
		else
		{
			timeSinceWall += fixedDeltaTime;
		}
		bool flag3 = remoteVel.y < (0f - body.moveSpeed) * 1.3f;
		if (body.isSprinting)
		{
			remoteNotSprintTimer = 0f;
		}
		else
		{
			remoteNotSprintTimer += fixedDeltaTime;
		}
		if (flag || flag3 || remoteNotSprintTimer > 0.25f || timeSinceWall > 0.2f)
		{
			isClimbing = false;
			remoteCandidateTimer = 0f;
			Debug.Log((object)"[RexClimb] Remote REX climb ended");
		}
	}

	private void StartClimb()
	{
		isClimbing = true;
		hasLastPos = false;
		blockedTimer = 0f;
		lastUpFactor = 1f;
		lastCommandSpeed = 0f;
		Debug.Log((object)"[RexClimb] Climb started");
	}

	private void StopClimb(bool lostWall)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
		isClimbing = false;
		Debug.Log((object)("[RexClimb] Climb ended" + (lostWall ? " (reached top or lost wall)" : "")));
		if (lostWall)
		{
			if (lastUpFactor > 0.3f)
			{
				Vector3 val = -wallNormal;
				val.y = 0f;
				val = ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val)).normalized : Vector3.zero);
				motor.velocity = Vector3.up * 4f + val * Mathf.Min(body.moveSpeed, 10f);
			}
			reattachTimer = 0.3f;
		}
	}

	private void JumpOff()
	{
		//IL_0018: 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_0027: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		isClimbing = false;
		Debug.Log((object)"[RexClimb] Jumped off wall");
		motor.velocity = wallNormal * 12f + Vector3.up * 14f;
		reattachTimer = 0.4f;
	}

	private void ReleaseBlocked()
	{
		//IL_002a: 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)
		isClimbing = false;
		blockedTimer = 0f;
		hasLastPos = false;
		Debug.Log((object)"[RexClimb] Climb blocked (no progress), releasing");
		motor.velocity = wallNormal * 3f;
		reattachTimer = 0.6f;
	}

	private void ApplyClimb()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: 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)
		Vector3 val = Vector3.ProjectOnPlane(Vector3.up, wallNormal);
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		float num = body.moveSpeed * 1f;
		float num2 = 1f;
		float num3 = 0f;
		Vector3 val2 = Vector3.zero;
		Vector3 val3 = wallNormal;
		val3.y = 0f;
		Vector3 moveVector = body.inputBank.moveVector;
		moveVector.y = 0f;
		Vector3 aimDirection = body.inputBank.aimDirection;
		aimDirection.y = 0f;
		if (((Vector3)(ref val3)).sqrMagnitude > 0.001f && ((Vector3)(ref moveVector)).sqrMagnitude > 0.001f)
		{
			((Vector3)(ref val3)).Normalize();
			val2 = Vector3.Cross(Vector3.up, val3);
			num3 = Mathf.Clamp(Vector3.Dot(moveVector, val2), -1f, 1f);
			if (((Vector3)(ref aimDirection)).sqrMagnitude > 0.001f)
			{
				((Vector3)(ref aimDirection)).Normalize();
				num2 = Mathf.Clamp(Vector3.Dot(moveVector, aimDirection) * 1.5f, -1f, 1f);
			}
		}
		Vector3 val4 = normalized * (num * num2) + val2 * (num * 0.8f * num3) + normalized * (0.5f * (1f - Mathf.Abs(num2)));
		motor.velocity = val4 - wallNormal * 2f;
		lastUpFactor = num2;
		lastCommandSpeed = ((Vector3)(ref val4)).magnitude;
		lastCommandDir = ((lastCommandSpeed > 0.001f) ? (val4 / lastCommandSpeed) : Vector3.zero);
	}
}
[DefaultExecutionOrder(10000)]
public class RexClimbVisuals : MonoBehaviour
{
	private const float BlendInTime = 0.12f;

	private const float BlendOutTime = 0.12f;

	private const float SoundStartDelay = 0.2f;

	private const float SoundStopDelay = 0.35f;

	private const float RestMaxTilt = 20f;

	private static readonly string[] ParticleNames = new string[3] { "Debris", "Dust", "Roots" };

	private const string SoundObjectName = "SprintLoopSound";

	private CharacterBody body;

	private CharacterMotor motor;

	private RexClimbBehavior climb;

	private Animator animator;

	private readonly HashSet<string> animParams = new HashSet<string>();

	private float blend;

	private Vector3 lastNormal = Vector3.up;

	private Vector3 restOffset;

	private Quaternion restRot = Quaternion.identity;

	private bool haveRest;

	private bool lastFloorAlign = true;

	private ParticleSystem[] sprintParticles = (ParticleSystem[])(object)new ParticleSystem[0];

	private GameObject sprintSound;

	private GameObject soundClone;

	private bool effectsCached;

	private float cacheTimer;

	private Transform rootsTf;

	private Vector3 rootsRestLocalPos;

	private Quaternion rootsRestLocalRot = Quaternion.identity;

	private bool rootsMoved;

	private readonly List<ParticleSystem> startedParticles = new List<ParticleSystem>();

	private bool wasEnforcing;

	private float soundActiveTime;

	private float soundInactiveTime;

	private float gameOffTime;

	private bool Active
	{
		get
		{
			if (Object.op_Implicit((Object)(object)climb) && climb.IsClimbing)
			{
				return ClimbDebug.VisualsEnabled;
			}
			return false;
		}
	}

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
		climb = ((Component)this).GetComponent<RexClimbBehavior>();
	}

	private void FindAnimator()
	{
		if (Object.op_Implicit((Object)(object)animator) || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			return;
		}
		animator = ((Component)body.modelLocator.modelTransform).GetComponentInChildren<Animator>();
		if (Object.op_Implicit((Object)(object)animator))
		{
			AnimatorControllerParameter[] parameters = animator.parameters;
			foreach (AnimatorControllerParameter val in parameters)
			{
				animParams.Add(val.name);
			}
			Debug.Log((object)("[RexClimb] Animator parameters: " + string.Join(", ", animParams)));
		}
	}

	private void SetBool(string name, bool value)
	{
		if (animParams.Contains(name))
		{
			animator.SetBool(name, value);
		}
	}

	private void SetFloat(string name, float value)
	{
		if (animParams.Contains(name))
		{
			animator.SetFloat(name, value);
		}
	}

	private void CacheEffects()
	{
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		if (effectsCached || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			return;
		}
		cacheTimer += Time.deltaTime;
		Transform modelTransform = body.modelLocator.modelTransform;
		List<ParticleSystem> list = new List<ParticleSystem>();
		ParticleSystem[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<ParticleSystem>(true);
		string[] particleNames = ParticleNames;
		ParticleSystem[] array;
		foreach (string text in particleNames)
		{
			array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				if (((Object)val).name == text)
				{
					list.Add(val);
					break;
				}
			}
		}
		GameObject val2 = null;
		Transform[] componentsInChildren2 = ((Component)modelTransform).GetComponentsInChildren<Transform>(true);
		foreach (Transform val3 in componentsInChildren2)
		{
			if (((Object)val3).name == "SprintLoopSound")
			{
				val2 = ((Component)val3).gameObject;
				break;
			}
		}
		if (!Object.op_Implicit((Object)(object)val2))
		{
			componentsInChildren2 = ((Component)((Component)this).transform).GetComponentsInChildren<Transform>(true);
			foreach (Transform val4 in componentsInChildren2)
			{
				if (((Object)val4).name == "SprintLoopSound")
				{
					val2 = ((Component)val4).gameObject;
					break;
				}
			}
		}
		if ((list.Count != ParticleNames.Length || !Object.op_Implicit((Object)(object)val2)) && cacheTimer < 3f)
		{
			return;
		}
		sprintParticles = list.ToArray();
		sprintSound = val2;
		if (Object.op_Implicit((Object)(object)val2))
		{
			soundClone = Object.Instantiate<GameObject>(val2, val2.transform.parent);
			((Object)soundClone).name = "RexClimbSprintSound";
			soundClone.SetActive(false);
		}
		array = sprintParticles;
		foreach (ParticleSystem val5 in array)
		{
			if (Object.op_Implicit((Object)(object)val5) && ((Object)val5).name == "Roots")
			{
				rootsTf = ((Component)val5).transform;
				rootsRestLocalPos = rootsTf.localPosition;
				rootsRestLocalRot = rootsTf.localRotation;
			}
		}
		effectsCached = true;
		Debug.Log((object)("[RexClimb] Cached effects: " + list.Count + " of " + ParticleNames.Length + " particle systems, sound object " + (Object.op_Implicit((Object)(object)val2) ? "found" : "NOT found") + ", sound copy " + (Object.op_Implicit((Object)(object)soundClone) ? "created" : "NOT created")));
	}

	private void EnforceEffects(bool on)
	{
		if (!effectsCached)
		{
			return;
		}
		if (on)
		{
			if (ClimbDebug.ForceParticles)
			{
				ParticleSystem[] array = sprintParticles;
				foreach (ParticleSystem val in array)
				{
					if (Object.op_Implicit((Object)(object)val) && ((Component)val).gameObject.activeInHierarchy && !val.isPlaying)
					{
						val.Play();
						if (!startedParticles.Contains(val))
						{
							startedParticles.Add(val);
						}
					}
				}
			}
			wasEnforcing = true;
		}
		else
		{
			if (!wasEnforcing)
			{
				return;
			}
			wasEnforcing = false;
			if (!Object.op_Implicit((Object)(object)motor))
			{
				motor = body.characterMotor;
			}
			if (!body.isSprinting || !Object.op_Implicit((Object)(object)motor) || !motor.isGrounded)
			{
				foreach (ParticleSystem startedParticle in startedParticles)
				{
					if (Object.op_Implicit((Object)(object)startedParticle))
					{
						startedParticle.Stop(true, (ParticleSystemStopBehavior)1);
					}
				}
			}
			startedParticles.Clear();
		}
	}

	private void UpdateSound(bool active)
	{
		if (effectsCached && Object.op_Implicit((Object)(object)soundClone))
		{
			float deltaTime = Time.deltaTime;
			bool num = active && ClimbDebug.ForceSound;
			bool flag = Object.op_Implicit((Object)(object)sprintSound) && sprintSound.activeSelf;
			if (num)
			{
				soundActiveTime += deltaTime;
				soundInactiveTime = 0f;
			}
			else
			{
				soundInactiveTime += deltaTime;
				soundActiveTime = 0f;
			}
			if (flag)
			{
				gameOffTime = 0f;
			}
			else
			{
				gameOffTime += deltaTime;
			}
			bool activeSelf = soundClone.activeSelf;
			bool flag2 = ((!activeSelf) ? (soundActiveTime > 0.2f && gameOffTime > 0.2f) : (!flag && soundInactiveTime < 0.35f));
			if (flag2 != activeSelf)
			{
				soundClone.SetActive(flag2);
			}
		}
	}

	private void Update()
	{
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)climb))
		{
			return;
		}
		CacheEffects();
		if (ClimbDebug.DumpRequested)
		{
			ClimbDebug.DumpRequested = false;
			Dump();
		}
		if (Active)
		{
			FindAnimator();
			if (Object.op_Implicit((Object)(object)animator))
			{
				SetBool("isGrounded", value: true);
				SetBool("isMoving", value: true);
				SetBool("isSprinting", value: true);
				SetFloat("forwardSpeed", body.moveSpeed);
				SetFloat("rightSpeed", 0f);
			}
		}
	}

	private void LateUpdate()
	{
		//IL_0088: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: 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)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//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_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: 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_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)climb) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			return;
		}
		if (ClimbDebug.FloorAlign != lastFloorAlign)
		{
			body.modelLocator.normalizeToFloor = ClimbDebug.FloorAlign;
			lastFloorAlign = ClimbDebug.FloorAlign;
		}
		Transform modelTransform = body.modelLocator.modelTransform;
		Quaternion rotation = ((Component)this).transform.rotation;
		Vector3 position = ((Component)this).transform.position;
		bool active = Active;
		int num;
		if (active)
		{
			num = (climb.WallContact ? 1 : 0);
			if (num != 0)
			{
				lastNormal = climb.WallNormal;
			}
		}
		else
		{
			num = 0;
		}
		EnforceEffects(active);
		UpdateSound(active);
		float num2 = ((num != 0) ? 1f : 0f);
		float num3 = ((num2 > blend) ? 8.333334f : 8.333334f);
		blend = Mathf.MoveTowards(blend, num2, num3 * Time.deltaTime);
		if (blend <= 0f)
		{
			Quaternion val = Quaternion.Inverse(rotation);
			Quaternion val2 = val * modelTransform.rotation;
			float num4 = Vector3.Angle(val2 * Vector3.up, Vector3.up);
			if (!haveRest || num4 < 20f)
			{
				restOffset = val * (modelTransform.position - position);
				restRot = val2;
				haveRest = true;
			}
			if (rootsMoved && Object.op_Implicit((Object)(object)rootsTf))
			{
				rootsTf.localPosition = rootsRestLocalPos;
				rootsTf.localRotation = rootsRestLocalRot;
				rootsMoved = false;
			}
			return;
		}
		Vector3 val3 = lastNormal;
		Vector3 val4 = Vector3.ProjectOnPlane(Vector3.up, val3);
		if (((Vector3)(ref val4)).sqrMagnitude < 0.001f)
		{
			return;
		}
		((Vector3)(ref val4)).Normalize();
		Vector3 val5 = (ClimbDebug.Flip ? (-val3) : val3);
		Quaternion val6 = Quaternion.AngleAxis(90f * (float)ClimbDebug.SpinSteps, Vector3.up);
		Quaternion val7 = Quaternion.LookRotation(val4, val5) * val6 * restRot;
		Quaternion val8 = Quaternion.Slerp(rotation * restRot, val7, blend);
		Vector3 val9 = Quaternion.Inverse(restRot) * restOffset;
		Vector3 val10 = position + val8 * val9 + val3 * (ClimbDebug.WallOffset * blend);
		modelTransform.SetPositionAndRotation(val10, val8);
		if (!Object.op_Implicit((Object)(object)rootsTf))
		{
			return;
		}
		rootsTf.localPosition = rootsRestLocalPos;
		rootsTf.localRotation = rootsRestLocalRot;
		if (ClimbDebug.RootsAngle != 0 && blend > 0.5f)
		{
			Vector3 val11 = Vector3.Cross(Vector3.up, val3);
			if (((Vector3)(ref val11)).sqrMagnitude > 0.001f)
			{
				((Vector3)(ref val11)).Normalize();
				Quaternion val12 = Quaternion.identity;
				if (ClimbDebug.RootsAngle == 1)
				{
					val12 = Quaternion.AngleAxis(90f, val3);
				}
				else if (ClimbDebug.RootsAngle == 2)
				{
					val12 = Quaternion.AngleAxis(90f, val11);
				}
				else if (ClimbDebug.RootsAngle == 3)
				{
					val12 = Quaternion.AngleAxis(-90f, val3);
				}
				rootsTf.rotation = val12 * rootsTf.rotation;
			}
		}
		Transform obj = rootsTf;
		obj.position += val3 * (ClimbDebug.RootsLift * blend);
		rootsMoved = true;
	}

	private void Dump()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Invalid comparison between Unknown and I4
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Invalid comparison between Unknown and I4
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Invalid comparison between Unknown and I4
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		FindAnimator();
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("[RexClimb] DUMP (climbing = " + climb.IsClimbing + ")");
		if (Object.op_Implicit((Object)(object)animator))
		{
			AnimatorControllerParameter[] parameters = animator.parameters;
			foreach (AnimatorControllerParameter val in parameters)
			{
				string text = "";
				if ((int)val.type == 4)
				{
					text = animator.GetBool(val.name).ToString();
				}
				else if ((int)val.type == 1)
				{
					text = animator.GetFloat(val.name).ToString("F2");
				}
				else if ((int)val.type == 3)
				{
					text = animator.GetInteger(val.name).ToString();
				}
				stringBuilder.AppendLine("  param " + val.name + " = " + text);
			}
			AnimatorClipInfo[] currentAnimatorClipInfo = animator.GetCurrentAnimatorClipInfo(0);
			for (int i = 0; i < currentAnimatorClipInfo.Length; i++)
			{
				AnimatorClipInfo val2 = currentAnimatorClipInfo[i];
				stringBuilder.AppendLine("  clip(layer 0) " + ((Object)((AnimatorClipInfo)(ref val2)).clip).name + " weight " + ((AnimatorClipInfo)(ref val2)).weight.ToString("F2"));
			}
		}
		if (Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			ParticleSystem[] componentsInChildren = ((Component)body.modelLocator.modelTransform).GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem val3 in componentsInChildren)
			{
				stringBuilder.AppendLine("  particles " + ((Object)val3).name + " active=" + ((Component)val3).gameObject.activeInHierarchy + " playing=" + val3.isPlaying);
			}
		}
		if (Object.op_Implicit((Object)(object)sprintSound))
		{
			stringBuilder.AppendLine("  game SprintLoopSound active=" + sprintSound.activeSelf + " parent=" + (Object.op_Implicit((Object)(object)sprintSound.transform.parent) ? ((Object)sprintSound.transform.parent).name : "none"));
			Component[] components = sprintSound.GetComponents<Component>();
			foreach (Component val4 in components)
			{
				if ((Object)(object)val4 != (Object)null)
				{
					stringBuilder.AppendLine("    component " + ((object)val4).GetType().FullName);
				}
			}
		}
		if (Object.op_Implicit((Object)(object)soundClone))
		{
			stringBuilder.AppendLine("  our sound copy active=" + soundClone.activeSelf);
		}
		stringBuilder.AppendLine("  move speed = " + body.moveSpeed.ToString("F1") + ", wall offset = " + ClimbDebug.WallOffset.ToString("F1") + ", roots lift = " + ClimbDebug.RootsLift.ToString("F1") + ", roots angle = " + ClimbDebug.RootsAngle);
		if (Object.op_Implicit((Object)(object)body.modelLocator))
		{
			Transform modelTransform = body.modelLocator.modelTransform;
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				string[] obj = new string[8]
				{
					"  model ",
					((Object)modelTransform).name,
					" parent=",
					Object.op_Implicit((Object)(object)modelTransform.parent) ? ((Object)modelTransform.parent).name : "none (detached)",
					" localEuler=",
					null,
					null,
					null
				};
				Vector3 localEulerAngles = modelTransform.localEulerAngles;
				obj[5] = ((Vector3)(ref localEulerAngles)).ToString("F0");
				obj[6] = " tiltVsBodyUp=";
				obj[7] = Vector3.Angle(modelTransform.up, ((Component)this).transform.up).ToString("F0");
				stringBuilder.AppendLine(string.Concat(obj));
			}
			FieldInfo[] fields = typeof(ModelLocator).GetFields(BindingFlags.Instance | BindingFlags.Public);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.FieldType == typeof(bool) || fieldInfo.FieldType == typeof(float) || fieldInfo.FieldType == typeof(int))
				{
					object obj2 = null;
					try
					{
						obj2 = fieldInfo.GetValue(body.modelLocator);
					}
					catch
					{
					}
					stringBuilder.AppendLine("  ModelLocator." + fieldInfo.Name + " = " + obj2);
				}
			}
		}
		Debug.Log((object)stringBuilder.ToString());
	}
}