using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000458 RID: 1112
	[Token(Token = "0x2000458")]
	[HelpURL("http://www.root-motion.com/finalikdox/html/page11.html")]
	[AddComponentMenu("Scripts/RootMotion.FinalIK/Grounder/Grounder Quadruped")]
	public class GrounderQuadruped : Grounder
	{
		// Token: 0x06002765 RID: 10085 RVA: 0x0005A8D4 File Offset: 0x00058AD4
		[Token(Token = "0x6002765")]
		[Address(RVA = "0x16FFA80", Offset = "0x16FEA80", VA = "0x1816FFA80", Slot = "5")]
		[ContextMenu("User Manual")]
		protected override void OpenUserManual()
		{
			Application.OpenURL("http://www.root-motion.com/finalikdox/html/page11.html");
		}

		// Token: 0x06002766 RID: 10086 RVA: 0x0005A8EC File Offset: 0x00058AEC
		[Token(Token = "0x6002766")]
		[Address(RVA = "0x16FFA40", Offset = "0x16FEA40", VA = "0x1816FFA40", Slot = "6")]
		[ContextMenu("Scrpt Reference")]
		protected override void OpenScriptReference()
		{
			Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_grounder_quadruped.html");
		}

		// Token: 0x06002767 RID: 10087 RVA: 0x0005A904 File Offset: 0x00058B04
		[Token(Token = "0x6002767")]
		[Address(RVA = "0x16FFAC0", Offset = "0x16FEAC0", VA = "0x1816FFAC0", Slot = "4")]
		public override void ResetPosition()
		{
			this.solver.Reset();
			this.forelegSolver.Reset();
		}

		// Token: 0x06002768 RID: 10088 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002768")]
		[Address(RVA = "0x16FEAA0", Offset = "0x16FDAA0", VA = "0x1816FEAA0")]
		private bool IsReadyToInitiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002769 RID: 10089 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002769")]
		[Address(RVA = "0x16FE8D0", Offset = "0x16FD8D0", VA = "0x1816FE8D0")]
		private bool IsReadyToInitiateLegs(IK[] ikComponents)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600276A RID: 10090 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600276A")]
		[Address(RVA = "0x16FED20", Offset = "0x16FDD20", VA = "0x1816FED20")]
		private void OnDisable()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600276B RID: 10091 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600276B")]
		[Address(RVA = "0x1700400", Offset = "0x16FF400", VA = "0x181700400")]
		private void Update()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600276C RID: 10092 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600276C")]
		[Address(RVA = "0x16FE500", Offset = "0x16FD500", VA = "0x1816FE500")]
		private void Initiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600276D RID: 10093 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600276D")]
		[Address(RVA = "0x16FE0C0", Offset = "0x16FD0C0", VA = "0x1816FE0C0")]
		private Transform[] InitiateFeet(IK[] ikComponents, ref GrounderQuadruped.Foot[] f, int indexOffset)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600276E RID: 10094 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600276E")]
		[Address(RVA = "0x16FEBF0", Offset = "0x16FDBF0", VA = "0x1816FEBF0")]
		private void LateUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600276F RID: 10095 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600276F")]
		[Address(RVA = "0x16FFB00", Offset = "0x16FEB00", VA = "0x1816FFB00")]
		private void RootRotation()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002770 RID: 10096 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002770")]
		[Address(RVA = "0x16FF110", Offset = "0x16FE110", VA = "0x1816FF110")]
		private void OnSolverUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002771 RID: 10097 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002771")]
		[Address(RVA = "0x17000E0", Offset = "0x16FF0E0", VA = "0x1817000E0")]
		private void UpdateForefeetRoot()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002772 RID: 10098 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002772")]
		[Address(RVA = "0x16FFF30", Offset = "0x16FEF30", VA = "0x1816FFF30")]
		private void SetFootIK(GrounderQuadruped.Foot foot, float maxOffset)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002773 RID: 10099 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002773")]
		[Address(RVA = "0x16FEDA0", Offset = "0x16FDDA0", VA = "0x1816FEDA0")]
		private void OnPostSolverUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002774 RID: 10100 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002774")]
		[Address(RVA = "0x16FECE0", Offset = "0x16FDCE0", VA = "0x1816FECE0")]
		private void OnDestroy()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002775 RID: 10101 RVA: 0x0005A930 File Offset: 0x00058B30
		[Token(Token = "0x6002775")]
		[Address(RVA = "0x16FDEA0", Offset = "0x16FCEA0", VA = "0x1816FDEA0")]
		private void DestroyLegs(IK[] ikComponents)
		{
			int num = 0;
			int num2 = 0;
			int length = ikComponents.Length;
			if (num2 < length)
			{
				IK ik = ikComponents[num];
				int num3 = 0;
				if (ik != num3)
				{
					IKSolver iksolver = ik.GetIKSolver();
					IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.OnSolverUpdate);
					Delegate @delegate = Delegate.Remove(updateDelegate, updateDelegate);
					int num4 = 0;
					if (@delegate != 0 && @delegate == 0)
					{
						throw new InvalidCastException();
					}
					iksolver.OnPreUpdate = num4;
					IKSolver iksolver2 = ik.GetIKSolver();
					IKSolver.UpdateDelegate updateDelegate2 = new IKSolver.UpdateDelegate(this.OnPostSolverUpdate);
					Delegate delegate2 = Delegate.Remove(updateDelegate2, updateDelegate2);
					if (delegate2 != 0 && delegate2 == 0)
					{
						throw new InvalidCastException();
					}
					iksolver2.OnPostUpdate = delegate2;
				}
				num++;
			}
		}

		// Token: 0x06002776 RID: 10102 RVA: 0x0005A9E0 File Offset: 0x00058BE0
		[Token(Token = "0x6002776")]
		[Address(RVA = "0x1700580", Offset = "0x16FF580", VA = "0x181700580")]
		public GrounderQuadruped()
		{
			Vector3 down = Vector3.down;
			int num = 0;
			float z = down.z;
			this.gravity.z = z;
			GrounderQuadruped.Foot[] array = new GrounderQuadruped.Foot[num];
			this.feet = array;
			base..ctor();
		}

		// Token: 0x04003130 RID: 12592
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4003130")]
		[Tooltip("The Grounding solver for the forelegs.")]
		public Grounding forelegSolver = new Grounding
		{
			maxStep = 0.5f,
			footSpeed = 2.5f,
			footRadius = 0.15f,
			prediction = 0.05f,
			footRotationWeight = 1f,
			footRotationSpeed = 7f,
			maxFootRotationAngle = 45f,
			pelvisSpeed = 5f,
			lowerPelvisWeight = 1f,
			rootSphereCastRadius = 0.1f,
			quality = (Grounding.Quality)((ulong)2L)
		};

		// Token: 0x04003131 RID: 12593
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4003131")]
		[Range(0f, 1f)]
		[Tooltip("The weight of rotating the character root to the ground angle (range: 0 - 1).")]
		public float rootRotationWeight = 0.5f;

		// Token: 0x04003132 RID: 12594
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x4003132")]
		[Tooltip("The maximum angle of rotating the quadruped downwards (going downhill, range: -90 - 0).")]
		[Range(-90f, 0f)]
		public float minRootRotation = -25f;

		// Token: 0x04003133 RID: 12595
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4003133")]
		[Tooltip("The maximum angle of rotating the quadruped upwards (going uphill, range: 0 - 90).")]
		[Range(0f, 90f)]
		public float maxRootRotation = 45f;

		// Token: 0x04003134 RID: 12596
		[FieldOffset(Offset = "0x54")]
		[Token(Token = "0x4003134")]
		[Tooltip("The speed of interpolating the character root rotation (range: 0 - inf).")]
		public float rootRotationSpeed = 5f;

		// Token: 0x04003135 RID: 12597
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4003135")]
		[Tooltip("The maximum IK offset for the legs (range: 0 - inf).")]
		public float maxLegOffset = 0.5f;

		// Token: 0x04003136 RID: 12598
		[FieldOffset(Offset = "0x5C")]
		[Token(Token = "0x4003136")]
		[Tooltip("The maximum IK offset for the forelegs (range: 0 - inf).")]
		public float maxForeLegOffset = 0.5f;

		// Token: 0x04003137 RID: 12599
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4003137")]
		[Tooltip("The weight of maintaining the head's rotation as it was before solving the Grounding (range: 0 - 1).")]
		[Range(0f, 1f)]
		public float maintainHeadRotationWeight = 0.5f;

		// Token: 0x04003138 RID: 12600
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x4003138")]
		[Tooltip("The root Transform of the character, with the rigidbody and the collider.")]
		public Transform characterRoot;

		// Token: 0x04003139 RID: 12601
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x4003139")]
		[Tooltip("The pelvis transform. Common ancestor of both legs and the spine.")]
		public Transform pelvis;

		// Token: 0x0400313A RID: 12602
		[FieldOffset(Offset = "0x78")]
		[Token(Token = "0x400313A")]
		[Tooltip("The last bone in the spine that is the common parent for both forelegs.")]
		public Transform lastSpineBone;

		// Token: 0x0400313B RID: 12603
		[FieldOffset(Offset = "0x80")]
		[Token(Token = "0x400313B")]
		[Tooltip("The head (optional, if you intend to maintain it's rotation).")]
		public Transform head;

		// Token: 0x0400313C RID: 12604
		[FieldOffset(Offset = "0x88")]
		[Token(Token = "0x400313C")]
		public IK[] legs;

		// Token: 0x0400313D RID: 12605
		[FieldOffset(Offset = "0x90")]
		[Token(Token = "0x400313D")]
		public IK[] forelegs;

		// Token: 0x0400313E RID: 12606
		[FieldOffset(Offset = "0x98")]
		[Token(Token = "0x400313E")]
		[HideInInspector]
		public Vector3 gravity;

		// Token: 0x0400313F RID: 12607
		[FieldOffset(Offset = "0xA8")]
		[Token(Token = "0x400313F")]
		private GrounderQuadruped.Foot[] feet;

		// Token: 0x04003140 RID: 12608
		[FieldOffset(Offset = "0xB0")]
		[Token(Token = "0x4003140")]
		private Vector3 animatedPelvisLocalPosition;

		// Token: 0x04003141 RID: 12609
		[FieldOffset(Offset = "0xBC")]
		[Token(Token = "0x4003141")]
		private Quaternion animatedPelvisLocalRotation;

		// Token: 0x04003142 RID: 12610
		[FieldOffset(Offset = "0xCC")]
		[Token(Token = "0x4003142")]
		private Quaternion animatedHeadLocalRotation;

		// Token: 0x04003143 RID: 12611
		[FieldOffset(Offset = "0xDC")]
		[Token(Token = "0x4003143")]
		private Vector3 solvedPelvisLocalPosition;

		// Token: 0x04003144 RID: 12612
		[FieldOffset(Offset = "0xE8")]
		[Token(Token = "0x4003144")]
		private Quaternion solvedPelvisLocalRotation;

		// Token: 0x04003145 RID: 12613
		[FieldOffset(Offset = "0xF8")]
		[Token(Token = "0x4003145")]
		private Quaternion solvedHeadLocalRotation;

		// Token: 0x04003146 RID: 12614
		[FieldOffset(Offset = "0x108")]
		[Token(Token = "0x4003146")]
		private int solvedFeet;

		// Token: 0x04003147 RID: 12615
		[FieldOffset(Offset = "0x10C")]
		[Token(Token = "0x4003147")]
		private bool solved;

		// Token: 0x04003148 RID: 12616
		[FieldOffset(Offset = "0x110")]
		[Token(Token = "0x4003148")]
		private float angle;

		// Token: 0x04003149 RID: 12617
		[FieldOffset(Offset = "0x118")]
		[Token(Token = "0x4003149")]
		private Transform forefeetRoot;

		// Token: 0x0400314A RID: 12618
		[FieldOffset(Offset = "0x120")]
		[Token(Token = "0x400314A")]
		private Quaternion headRotation;

		// Token: 0x0400314B RID: 12619
		[FieldOffset(Offset = "0x130")]
		[Token(Token = "0x400314B")]
		private float lastWeight;

		// Token: 0x02000459 RID: 1113
		[Token(Token = "0x2000459")]
		public struct Foot
		{
			// Token: 0x06002777 RID: 10103 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002777")]
			[Address(RVA = "0x16A2BF0", Offset = "0x16A1BF0", VA = "0x1816A2BF0")]
			public Foot(IKSolver solver, Transform transform)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x0400314C RID: 12620
			[FieldOffset(Offset = "0x0")]
			[Token(Token = "0x400314C")]
			public IKSolver solver;

			// Token: 0x0400314D RID: 12621
			[FieldOffset(Offset = "0x8")]
			[Token(Token = "0x400314D")]
			public Transform transform;

			// Token: 0x0400314E RID: 12622
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x400314E")]
			public Quaternion rotation;

			// Token: 0x0400314F RID: 12623
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x400314F")]
			public Grounding.Leg leg;
		}
	}
}
