using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x020003FD RID: 1021
	[Token(Token = "0x20003FD")]
	[HelpURL("https://www.youtube.com/watch?v=9MiZiaJorws&index=6&list=PLVxSIA1OaTOu8Nos3CalXbJ2DrKnntMv6")]
	[AddComponentMenu("Scripts/RootMotion.FinalIK/Grounder/Grounder Full Body Biped")]
	public class GrounderFBBIK : Grounder
	{
		// Token: 0x06002481 RID: 9345 RVA: 0x00053238 File Offset: 0x00051438
		[Token(Token = "0x6002481")]
		[Address(RVA = "0x1175AA0", Offset = "0x11748A0", VA = "0x181175AA0")]
		[ContextMenu("TUTORIAL VIDEO")]
		private void OpenTutorial()
		{
			Application.OpenURL("https://www.youtube.com/watch?v=9MiZiaJorws&index=6&list=PLVxSIA1OaTOu8Nos3CalXbJ2DrKnntMv6");
		}

		// Token: 0x06002482 RID: 9346 RVA: 0x00053250 File Offset: 0x00051450
		[Token(Token = "0x6002482")]
		[Address(RVA = "0x1175AE0", Offset = "0x11748E0", VA = "0x181175AE0", Slot = "5")]
		[ContextMenu("User Manual")]
		protected override void OpenUserManual()
		{
			Application.OpenURL("http://www.root-motion.com/finalikdox/html/page11.html");
		}

		// Token: 0x06002483 RID: 9347 RVA: 0x00053268 File Offset: 0x00051468
		[Token(Token = "0x6002483")]
		[Address(RVA = "0x1175A60", Offset = "0x1174860", VA = "0x181175A60", 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_f_b_b_i_k.html");
		}

		// Token: 0x06002484 RID: 9348 RVA: 0x00053280 File Offset: 0x00051480
		[Token(Token = "0x6002484")]
		[Address(RVA = "0x1175B20", Offset = "0x1174920", VA = "0x181175B20", Slot = "4")]
		public override void ResetPosition()
		{
			this.solver.Reset();
			float z = Vector3.zero.z;
			this.spineOffset.z = z;
		}

		// Token: 0x06002485 RID: 9349 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002485")]
		[Address(RVA = "0x11751D0", Offset = "0x1173FD0", VA = "0x1811751D0")]
		private bool IsReadyToInitiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002486 RID: 9350 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002486")]
		[Address(RVA = "0x1175D10", Offset = "0x1174B10", VA = "0x181175D10")]
		private void Update()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002487 RID: 9351 RVA: 0x000532B8 File Offset: 0x000514B8
		[Token(Token = "0x6002487")]
		[Address(RVA = "0x1174EF0", Offset = "0x1173CF0", VA = "0x181174EF0")]
		private void FixedUpdate()
		{
			this.firstSolve = true;
		}

		// Token: 0x06002488 RID: 9352 RVA: 0x000532CC File Offset: 0x000514CC
		[Token(Token = "0x6002488")]
		[Address(RVA = "0x1174EF0", Offset = "0x1173CF0", VA = "0x181174EF0")]
		private void LateUpdate()
		{
			this.firstSolve = true;
		}

		// Token: 0x06002489 RID: 9353 RVA: 0x000532E0 File Offset: 0x000514E0
		[Token(Token = "0x6002489")]
		[Address(RVA = "0x1174F00", Offset = "0x1173D00", VA = "0x181174F00")]
		private void Initiate()
		{
			this.ik.solver.leftLegMapping.maintainRotationWeight = 1f;
			this.ik.solver.rightLegMapping.maintainRotationWeight = 1f;
			Transform[] array = new Transform[2];
			this.feet = array;
			FullBodyBipedIK fullBodyBipedIK = this.ik;
			Transform[] array2 = this.feet;
			IKEffector leftFootEffector = fullBodyBipedIK.solver.leftFootEffector;
			Transform bone = leftFootEffector.bone;
			if (bone == 0 || leftFootEffector != 0)
			{
				array2[0] = bone;
				FullBodyBipedIK fullBodyBipedIK2 = this.ik;
				Transform[] array3 = this.feet;
				IKEffector rightFootEffector = fullBodyBipedIK2.solver.rightFootEffector;
				Transform bone2 = rightFootEffector.bone;
				if (bone2 == 0 || rightFootEffector != 0)
				{
					array3[1] = bone2;
					IKSolverFullBodyBiped solver = this.ik.solver;
					IKSolver.UpdateDelegate onPreUpdate = solver.OnPreUpdate;
					IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.OnSolverUpdate);
					Delegate @delegate = Delegate.Combine(onPreUpdate, updateDelegate);
					if (@delegate == 0 || @delegate != 0)
					{
						solver.OnPreUpdate = @delegate;
						BipedReferences references = this.ik.references;
						Grounding solver2 = this.solver;
						Transform[] array4 = this.feet;
						Transform root = references.root;
						solver2.Initiate(root, array4);
						this.initiated = true;
						return;
					}
				}
			}
			throw new InvalidCastException();
		}

		// Token: 0x0600248A RID: 9354 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600248A")]
		[Address(RVA = "0x1175500", Offset = "0x1174300", VA = "0x181175500")]
		private void OnSolverUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600248B RID: 9355 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600248B")]
		[Address(RVA = "0x1175B60", Offset = "0x1174960", VA = "0x181175B60")]
		private void SetLegIK(IKEffector effector, Grounding.Leg leg)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600248C RID: 9356 RVA: 0x0005342C File Offset: 0x0005162C
		[Token(Token = "0x600248C")]
		[Address(RVA = "0x11753A0", Offset = "0x11741A0", VA = "0x1811753A0")]
		private void OnDrawGizmosSelected()
		{
			FullBodyBipedIK fullBodyBipedIK = this.ik;
			int num = 0;
			if (fullBodyBipedIK == num)
			{
				FullBodyBipedIK component = base.GetComponent<FullBodyBipedIK>();
				this.ik = component;
			}
			FullBodyBipedIK fullBodyBipedIK2 = this.ik;
			int num2 = 0;
			if (fullBodyBipedIK2 == num2)
			{
				FullBodyBipedIK componentInParent = base.GetComponentInParent<FullBodyBipedIK>();
				this.ik = componentInParent;
			}
			FullBodyBipedIK fullBodyBipedIK3 = this.ik;
			int num3 = 0;
			if (fullBodyBipedIK3 == num3)
			{
				FullBodyBipedIK componentInChildren = base.GetComponentInChildren<FullBodyBipedIK>();
				this.ik = componentInChildren;
			}
		}

		// Token: 0x0600248D RID: 9357 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600248D")]
		[Address(RVA = "0x1175270", Offset = "0x1174070", VA = "0x181175270")]
		private void OnDestroy()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600248E RID: 9358 RVA: 0x000534A8 File Offset: 0x000516A8
		[Token(Token = "0x600248E")]
		[Address(RVA = "0x1175DF0", Offset = "0x1174BF0", VA = "0x181175DF0")]
		public GrounderFBBIK()
		{
			int num = 0;
			this.spineSpeed = 3f;
			GrounderFBBIK.SpineEffector[] array = new GrounderFBBIK.SpineEffector[num];
			this.spine = array;
			Transform[] array2 = new Transform[2];
			this.feet = array2;
			base..ctor();
		}

		// Token: 0x04002E2F RID: 11823
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4002E2F")]
		[Tooltip("Reference to the FBBIK componet.")]
		public FullBodyBipedIK ik;

		// Token: 0x04002E30 RID: 11824
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4002E30")]
		[Tooltip("The amount of spine bending towards upward slopes.")]
		public float spineBend = 2f;

		// Token: 0x04002E31 RID: 11825
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x4002E31")]
		[Tooltip("The interpolation speed of spine bending.")]
		public float spineSpeed;

		// Token: 0x04002E32 RID: 11826
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4002E32")]
		public GrounderFBBIK.SpineEffector[] spine;

		// Token: 0x04002E33 RID: 11827
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4002E33")]
		private Transform[] feet;

		// Token: 0x04002E34 RID: 11828
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4002E34")]
		private Vector3 spineOffset;

		// Token: 0x04002E35 RID: 11829
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x4002E35")]
		private bool firstSolve;

		// Token: 0x020003FE RID: 1022
		[Token(Token = "0x20003FE")]
		[Serializable]
		public class SpineEffector
		{
			// Token: 0x0600248F RID: 9359 RVA: 0x000534F0 File Offset: 0x000516F0
			[Token(Token = "0x600248F")]
			[Address(RVA = "0x5FD950", Offset = "0x5FC750", VA = "0x1805FD950")]
			public SpineEffector()
			{
			}

			// Token: 0x04002E36 RID: 11830
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4002E36")]
			[Tooltip("The type of the effector.")]
			public FullBodyBipedEffector effectorType;

			// Token: 0x04002E37 RID: 11831
			[FieldOffset(Offset = "0x14")]
			[Token(Token = "0x4002E37")]
			[Tooltip("The weight of horizontal bend offset towards the slope.")]
			public float horizontalWeight = 1f;

			// Token: 0x04002E38 RID: 11832
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x4002E38")]
			[Tooltip("The vertical bend offset weight.")]
			public float verticalWeight;
		}
	}
}
