using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000455 RID: 1109
	[Token(Token = "0x2000455")]
	[AddComponentMenu("Scripts/RootMotion.FinalIK/Grounder/Grounder Full Body Biped")]
	[HelpURL("https://www.youtube.com/watch?v=9MiZiaJorws&index=6&list=PLVxSIA1OaTOu8Nos3CalXbJ2DrKnntMv6")]
	public class GrounderFBBIK : Grounder
	{
		// Token: 0x0600274A RID: 10058 RVA: 0x0005A564 File Offset: 0x00058764
		[Token(Token = "0x600274A")]
		[Address(RVA = "0x16FC170", Offset = "0x16FB170", VA = "0x1816FC170")]
		[ContextMenu("TUTORIAL VIDEO")]
		private void OpenTutorial()
		{
			Application.OpenURL("https://www.youtube.com/watch?v=9MiZiaJorws&index=6&list=PLVxSIA1OaTOu8Nos3CalXbJ2DrKnntMv6");
		}

		// Token: 0x0600274B RID: 10059 RVA: 0x0005A57C File Offset: 0x0005877C
		[Token(Token = "0x600274B")]
		[Address(RVA = "0x16FC1B0", Offset = "0x16FB1B0", VA = "0x1816FC1B0", Slot = "5")]
		[ContextMenu("User Manual")]
		protected override void OpenUserManual()
		{
			Application.OpenURL("http://www.root-motion.com/finalikdox/html/page11.html");
		}

		// Token: 0x0600274C RID: 10060 RVA: 0x0005A594 File Offset: 0x00058794
		[Token(Token = "0x600274C")]
		[Address(RVA = "0x16FC130", Offset = "0x16FB130", VA = "0x1816FC130", 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: 0x0600274D RID: 10061 RVA: 0x0005A5AC File Offset: 0x000587AC
		[Token(Token = "0x600274D")]
		[Address(RVA = "0x16FC1F0", Offset = "0x16FB1F0", VA = "0x1816FC1F0", Slot = "4")]
		public override void ResetPosition()
		{
			this.solver.Reset();
			float z = Vector3.zero.z;
			this.spineOffset.z = z;
		}

		// Token: 0x0600274E RID: 10062 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600274E")]
		[Address(RVA = "0x16FB8A0", Offset = "0x16FA8A0", VA = "0x1816FB8A0")]
		private bool IsReadyToInitiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600274F RID: 10063 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600274F")]
		[Address(RVA = "0x16FC3E0", Offset = "0x16FB3E0", VA = "0x1816FC3E0")]
		private void Update()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002750 RID: 10064 RVA: 0x0005A5E4 File Offset: 0x000587E4
		[Token(Token = "0x6002750")]
		[Address(RVA = "0x16FB5C0", Offset = "0x16FA5C0", VA = "0x1816FB5C0")]
		private void FixedUpdate()
		{
			this.firstSolve = true;
		}

		// Token: 0x06002751 RID: 10065 RVA: 0x0005A5F8 File Offset: 0x000587F8
		[Token(Token = "0x6002751")]
		[Address(RVA = "0x16FB5C0", Offset = "0x16FA5C0", VA = "0x1816FB5C0")]
		private void LateUpdate()
		{
			this.firstSolve = true;
		}

		// Token: 0x06002752 RID: 10066 RVA: 0x0005A60C File Offset: 0x0005880C
		[Token(Token = "0x6002752")]
		[Address(RVA = "0x16FB5D0", Offset = "0x16FA5D0", VA = "0x1816FB5D0")]
		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: 0x06002753 RID: 10067 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002753")]
		[Address(RVA = "0x16FBBD0", Offset = "0x16FABD0", VA = "0x1816FBBD0")]
		private void OnSolverUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002754 RID: 10068 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002754")]
		[Address(RVA = "0x16FC230", Offset = "0x16FB230", VA = "0x1816FC230")]
		private void SetLegIK(IKEffector effector, Grounding.Leg leg)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002755 RID: 10069 RVA: 0x0005A758 File Offset: 0x00058958
		[Token(Token = "0x6002755")]
		[Address(RVA = "0x16FBA70", Offset = "0x16FAA70", VA = "0x1816FBA70")]
		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: 0x06002756 RID: 10070 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002756")]
		[Address(RVA = "0x16FB940", Offset = "0x16FA940", VA = "0x1816FB940")]
		private void OnDestroy()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002757 RID: 10071 RVA: 0x0005A7D4 File Offset: 0x000589D4
		[Token(Token = "0x6002757")]
		[Address(RVA = "0x16FC4C0", Offset = "0x16FB4C0", VA = "0x1816FC4C0")]
		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: 0x04003119 RID: 12569
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4003119")]
		[Tooltip("Reference to the FBBIK componet.")]
		public FullBodyBipedIK ik;

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

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

		// Token: 0x0400311C RID: 12572
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x400311C")]
		public GrounderFBBIK.SpineEffector[] spine;

		// Token: 0x0400311D RID: 12573
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x400311D")]
		private Transform[] feet;

		// Token: 0x0400311E RID: 12574
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x400311E")]
		private Vector3 spineOffset;

		// Token: 0x0400311F RID: 12575
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x400311F")]
		private bool firstSolve;

		// Token: 0x02000456 RID: 1110
		[Token(Token = "0x2000456")]
		[Serializable]
		public class SpineEffector
		{
			// Token: 0x06002758 RID: 10072 RVA: 0x0005A81C File Offset: 0x00058A1C
			[Token(Token = "0x6002758")]
			[Address(RVA = "0x696BE0", Offset = "0x695BE0", VA = "0x180696BE0")]
			public SpineEffector()
			{
			}

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

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

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