using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x020003F0 RID: 1008
	[Token(Token = "0x20003F0")]
	[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Biped IK")]
	[HelpURL("http://www.root-motion.com/finalikdox/html/page2.html")]
	public class BipedIK : SolverManager
	{
		// Token: 0x0600241F RID: 9247 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600241F")]
		[Address(RVA = "0x8D59E0", Offset = "0x8D47E0", VA = "0x1808D59E0")]
		[ContextMenu("User Manual")]
		private void OpenUserManual()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002420 RID: 9248 RVA: 0x000523E8 File Offset: 0x000505E8
		[Token(Token = "0x6002420")]
		[Address(RVA = "0x8D59A0", Offset = "0x8D47A0", VA = "0x1808D59A0")]
		[ContextMenu("Scrpt Reference")]
		private void OpenScriptReference()
		{
			Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_biped_i_k.html");
		}

		// Token: 0x06002421 RID: 9249 RVA: 0x00052400 File Offset: 0x00050600
		[Token(Token = "0x6002421")]
		[Address(RVA = "0x8D5F00", Offset = "0x8D4D00", VA = "0x1808D5F00")]
		[ContextMenu("Support Group")]
		private void SupportGroup()
		{
			Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
		}

		// Token: 0x06002422 RID: 9250 RVA: 0x00052418 File Offset: 0x00050618
		[Token(Token = "0x6002422")]
		[Address(RVA = "0x8D5290", Offset = "0x8D4090", VA = "0x1808D5290")]
		[ContextMenu("Asset Store Thread")]
		private void ASThread()
		{
			Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
		}

		// Token: 0x06002423 RID: 9251 RVA: 0x00052430 File Offset: 0x00050630
		[Token(Token = "0x6002423")]
		[Address(RVA = "0x8D5410", Offset = "0x8D4210", VA = "0x1808D5410")]
		public float GetIKPositionWeight(AvatarIKGoal goal)
		{
			if (goal != AvatarIKGoal.LeftFoot)
			{
				if (goal != AvatarIKGoal.LeftFoot)
				{
					if (goal != AvatarIKGoal.LeftFoot)
					{
						BipedIKSolvers bipedIKSolvers = this.solvers;
					}
					BipedIKSolvers bipedIKSolvers2 = this.solvers;
				}
				BipedIKSolvers bipedIKSolvers3 = this.solvers;
			}
			return this.solvers.leftFoot.IKPositionWeight;
		}

		// Token: 0x06002424 RID: 9252 RVA: 0x00052474 File Offset: 0x00050674
		[Token(Token = "0x6002424")]
		[Address(RVA = "0x8D5520", Offset = "0x8D4320", VA = "0x1808D5520")]
		public float GetIKRotationWeight(AvatarIKGoal goal)
		{
			if (goal != AvatarIKGoal.LeftFoot)
			{
				if (goal != AvatarIKGoal.LeftFoot)
				{
					if (goal != AvatarIKGoal.LeftFoot)
					{
						BipedIKSolvers bipedIKSolvers = this.solvers;
					}
					BipedIKSolvers bipedIKSolvers2 = this.solvers;
				}
				BipedIKSolvers bipedIKSolvers3 = this.solvers;
			}
			return this.solvers.leftFoot.IKRotationWeight;
		}

		// Token: 0x06002425 RID: 9253 RVA: 0x000524B8 File Offset: 0x000506B8
		[Token(Token = "0x6002425")]
		[Address(RVA = "0x8D5A20", Offset = "0x8D4820", VA = "0x1808D5A20")]
		public void SetIKPositionWeight(AvatarIKGoal goal, float weight)
		{
			if (goal != AvatarIKGoal.LeftFoot)
			{
				if (goal != AvatarIKGoal.LeftFoot)
				{
					if (goal != AvatarIKGoal.LeftFoot)
					{
						BipedIKSolvers bipedIKSolvers = this.solvers;
					}
					BipedIKSolvers bipedIKSolvers2 = this.solvers;
				}
				BipedIKSolvers bipedIKSolvers3 = this.solvers;
			}
			this.solvers.leftFoot.SetIKPositionWeight(weight);
		}

		// Token: 0x06002426 RID: 9254 RVA: 0x00052500 File Offset: 0x00050700
		[Token(Token = "0x6002426")]
		[Address(RVA = "0x8D5B10", Offset = "0x8D4910", VA = "0x1808D5B10")]
		public void SetIKRotationWeight(AvatarIKGoal goal, float weight)
		{
			if (goal != AvatarIKGoal.LeftFoot)
			{
				if (goal != AvatarIKGoal.LeftFoot)
				{
					if (goal != AvatarIKGoal.LeftFoot)
					{
						BipedIKSolvers bipedIKSolvers = this.solvers;
					}
					BipedIKSolvers bipedIKSolvers2 = this.solvers;
				}
				BipedIKSolvers bipedIKSolvers3 = this.solvers;
			}
			this.solvers.leftFoot.SetIKRotationWeight(weight);
		}

		// Token: 0x06002427 RID: 9255 RVA: 0x00052548 File Offset: 0x00050748
		[Token(Token = "0x6002427")]
		[Address(RVA = "0x8D5A90", Offset = "0x8D4890", VA = "0x1808D5A90")]
		public void SetIKPosition(AvatarIKGoal goal, Vector3 IKPosition)
		{
			if (goal != AvatarIKGoal.LeftFoot)
			{
				if (goal != AvatarIKGoal.LeftFoot)
				{
					if (goal != AvatarIKGoal.LeftFoot)
					{
						BipedIKSolvers bipedIKSolvers = this.solvers;
					}
					BipedIKSolvers bipedIKSolvers2 = this.solvers;
				}
				BipedIKSolvers bipedIKSolvers3 = this.solvers;
			}
			IKSolverLimb leftFoot = this.solvers.leftFoot;
			float z = IKPosition.z;
			leftFoot.IKPosition.z = z;
		}

		// Token: 0x06002428 RID: 9256 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002428")]
		[Address(RVA = "0x8D5B80", Offset = "0x8D4980", VA = "0x1808D5B80")]
		public void SetIKRotation(AvatarIKGoal goal, Quaternion IKRotation)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002429 RID: 9257 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002429")]
		[Address(RVA = "0x8D5480", Offset = "0x8D4280", VA = "0x1808D5480")]
		public Vector3 GetIKPosition(AvatarIKGoal goal)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600242A RID: 9258 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600242A")]
		[Address(RVA = "0x8D5590", Offset = "0x8D4390", VA = "0x1808D5590")]
		public Quaternion GetIKRotation(AvatarIKGoal goal)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600242B RID: 9259 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600242B")]
		[Address(RVA = "0x8D5C20", Offset = "0x8D4A20", VA = "0x1808D5C20")]
		public void SetLookAtWeight(float weight, float bodyWeight, float headWeight, float eyesWeight, float clampWeight, float clampWeightHead, float clampWeightEyes)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600242C RID: 9260 RVA: 0x000525A0 File Offset: 0x000507A0
		[Token(Token = "0x600242C")]
		[Address(RVA = "0x8D5BF0", Offset = "0x8D49F0", VA = "0x1808D5BF0")]
		public void SetLookAtPosition(Vector3 lookAtPosition)
		{
			IKSolverLookAt lookAt = this.solvers.lookAt;
			float z = lookAtPosition.z;
			lookAt.IKPosition.z = z;
		}

		// Token: 0x0600242D RID: 9261 RVA: 0x000525D4 File Offset: 0x000507D4
		[Token(Token = "0x600242D")]
		[Address(RVA = "0x8D5C60", Offset = "0x8D4A60", VA = "0x1808D5C60")]
		public void SetSpinePosition(Vector3 spinePosition)
		{
			IKSolverFABRIK spine = this.solvers.spine;
			float z = spinePosition.z;
			spine.IKPosition.z = z;
		}

		// Token: 0x0600242E RID: 9262 RVA: 0x00052608 File Offset: 0x00050808
		[Token(Token = "0x600242E")]
		[Address(RVA = "0x8D5C90", Offset = "0x8D4A90", VA = "0x1808D5C90")]
		public void SetSpineWeight(float weight)
		{
			this.solvers.spine.SetIKPositionWeight(weight);
		}

		// Token: 0x0600242F RID: 9263 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600242F")]
		[Address(RVA = "0x8D53A0", Offset = "0x8D41A0", VA = "0x1808D53A0")]
		public IKSolverLimb GetGoalIK(AvatarIKGoal goal)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002430 RID: 9264 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002430")]
		[Address(RVA = "0x638370", Offset = "0x637170", VA = "0x180638370")]
		public void InitiateBipedIK()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002431 RID: 9265 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002431")]
		[Address(RVA = "0x30E190", Offset = "0x30CF90", VA = "0x18030E190")]
		public void UpdateBipedIK()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002432 RID: 9266 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002432")]
		[Address(RVA = "0x8D5CC0", Offset = "0x8D4AC0", VA = "0x1808D5CC0")]
		public void SetToDefaults()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002433 RID: 9267 RVA: 0x0005262C File Offset: 0x0005082C
		[Token(Token = "0x6002433")]
		[Address(RVA = "0x8D52D0", Offset = "0x8D40D0", VA = "0x1808D52D0", Slot = "6")]
		protected override void FixTransforms()
		{
			this.solvers.lookAt.FixTransforms();
			BipedIKSolvers bipedIKSolvers = this.solvers;
			int num = 0;
			IKSolverLimb[] limbs = bipedIKSolvers.limbs;
			if (num < limbs.Length)
			{
				this.solvers.limbs[num].FixTransforms();
				BipedIKSolvers bipedIKSolvers2 = this.solvers;
				num++;
			}
		}

		// Token: 0x06002434 RID: 9268 RVA: 0x0005268C File Offset: 0x0005088C
		[Token(Token = "0x6002434")]
		[Address(RVA = "0x8D5600", Offset = "0x8D4400", VA = "0x1808D5600", Slot = "4")]
		protected override void InitiateSolver()
		{
			string text;
			if (!BipedReferences.SetupError(this.references, text))
			{
				BipedIKSolvers bipedIKSolvers = this.solvers;
				BipedReferences bipedReferences = this.references;
				IKSolverLimb leftHand = bipedIKSolvers.leftHand;
				Transform root = bipedReferences.root;
				int num = 0;
				Transform leftHand2 = bipedReferences.leftHand;
				Transform leftForearm = bipedReferences.leftForearm;
				Transform leftUpperArm = bipedReferences.leftUpperArm;
				bool flag = leftHand.SetChain(leftUpperArm, leftForearm, leftHand2, root);
				IKSolverLimb rightHand = bipedIKSolvers.rightHand;
				Transform root2 = bipedReferences.root;
				Transform rightHand2 = bipedReferences.rightHand;
				Transform rightForearm = bipedReferences.rightForearm;
				Transform rightUpperArm = bipedReferences.rightUpperArm;
				bool flag2 = rightHand.SetChain(rightUpperArm, rightForearm, rightHand2, root2);
				IKSolverLimb leftFoot = bipedIKSolvers.leftFoot;
				Transform root3 = bipedReferences.root;
				Transform leftFoot2 = bipedReferences.leftFoot;
				Transform leftCalf = bipedReferences.leftCalf;
				Transform leftThigh = bipedReferences.leftThigh;
				bool flag3 = leftFoot.SetChain(leftThigh, leftCalf, leftFoot2, root3);
				IKSolverLimb rightFoot = bipedIKSolvers.rightFoot;
				Transform root4 = bipedReferences.root;
				Transform rightFoot2 = bipedReferences.rightFoot;
				Transform rightCalf = bipedReferences.rightCalf;
				Transform rightThigh = bipedReferences.rightThigh;
				bool flag4 = rightFoot.SetChain(rightThigh, rightCalf, rightFoot2, root4);
				IKSolverFABRIK spine = bipedIKSolvers.spine;
				Transform root5 = bipedReferences.root;
				Transform[] spine2 = bipedReferences.spine;
				bool flag5 = spine.SetChain(spine2, root5);
				IKSolverLookAt lookAt = bipedIKSolvers.lookAt;
				Transform root6 = bipedReferences.root;
				Transform[] eyes = bipedReferences.eyes;
				Transform head = bipedReferences.head;
				Transform[] spine3 = bipedReferences.spine;
				bool flag6 = lookAt.SetChain(spine3, head, eyes, root6);
				IKSolverAim aim = bipedIKSolvers.aim;
				Transform root7 = bipedReferences.root;
				Transform[] spine4 = bipedReferences.spine;
				bool flag7 = aim.SetChain(spine4, root7);
				bipedIKSolvers.leftFoot.goal = (AvatarIKGoal)num;
				bipedIKSolvers.rightFoot.goal = (AvatarIKGoal)((ulong)1L);
				bipedIKSolvers.leftHand.goal = (AvatarIKGoal)((ulong)2L);
				bipedIKSolvers.rightHand.goal = (AvatarIKGoal)((ulong)3L);
				BipedIKSolvers bipedIKSolvers2 = this.solvers;
				IKSolverFABRIK spine5 = bipedIKSolvers2.spine;
				if (spine5.bones.Length > 1)
				{
					Transform transform = base.transform;
					spine5.Initiate(transform);
					BipedIKSolvers bipedIKSolvers3 = this.solvers;
				}
				IKSolverLookAt lookAt2 = bipedIKSolvers2.lookAt;
				Transform transform2 = base.transform;
				lookAt2.Initiate(transform2);
				IKSolverAim aim2 = this.solvers.aim;
				Transform transform3 = base.transform;
				aim2.Initiate(transform3);
				IKSolverLimb[] limbs = this.solvers.limbs;
				int length = limbs.Length;
				if (num < length)
				{
					IKSolverLimb iksolverLimb = limbs[num];
					Transform transform4 = base.transform;
					iksolverLimb.Initiate(transform4);
					num++;
				}
				BipedIKSolvers bipedIKSolvers4 = this.solvers;
				BipedReferences bipedReferences2 = this.references;
				Constraints pelvis = bipedIKSolvers4.pelvis;
				Transform pelvis2 = bipedReferences2.pelvis;
				pelvis.Initiate(pelvis2);
				return;
			}
			Transform root8 = this.references.root;
			int num2 = 0;
			Warning.Log(text, root8, num2 != 0);
			throw new NullReferenceException();
		}

		// Token: 0x06002435 RID: 9269 RVA: 0x00052954 File Offset: 0x00050B54
		[Token(Token = "0x6002435")]
		[Address(RVA = "0x8D5F40", Offset = "0x8D4D40", VA = "0x1808D5F40", Slot = "5")]
		protected override void UpdateSolver()
		{
			int num;
			IKSolverFABRIK spine;
			do
			{
				BipedIKSolvers bipedIKSolvers = this.solvers;
				num = 0;
				IKSolverLimb[] limbs = bipedIKSolvers.limbs;
				BipedIKSolvers bipedIKSolvers2 = this.solvers;
				if (num < limbs.Length)
				{
					bipedIKSolvers2.limbs[num].MaintainBend();
					this.solvers.limbs[num].MaintainRotation();
					BipedIKSolvers bipedIKSolvers3 = this.solvers;
					num++;
				}
				bipedIKSolvers2.pelvis.Update();
				spine = this.solvers.spine;
			}
			while (spine.bones.Length <= 1);
			spine.Update();
			this.solvers.aim.Update();
			this.solvers.lookAt.Update();
			IKSolverLimb[] limbs2 = this.solvers.limbs;
			if (num < limbs2.Length)
			{
				this.solvers.limbs[num].Update();
				BipedIKSolvers bipedIKSolvers4 = this.solvers;
				num++;
				while (bipedIKSolvers4 != 0)
				{
				}
			}
		}

		// Token: 0x06002436 RID: 9270 RVA: 0x00052A48 File Offset: 0x00050C48
		[Token(Token = "0x6002436")]
		[Address(RVA = "0x8D5970", Offset = "0x8D4770", VA = "0x1808D5970")]
		public void LogWarning(string message)
		{
			Transform transform = base.transform;
			int num = 0;
			Warning.Log(message, transform, num != 0);
		}

		// Token: 0x06002437 RID: 9271 RVA: 0x00052A68 File Offset: 0x00050C68
		[Token(Token = "0x6002437")]
		[Address(RVA = "0x8D6160", Offset = "0x8D4F60", VA = "0x1808D6160")]
		public BipedIK()
		{
			BipedReferences bipedReferences = new BipedReferences();
			this.references = bipedReferences;
			BipedIKSolvers bipedIKSolvers = new BipedIKSolvers();
			this.solvers = bipedIKSolvers;
			base..ctor();
		}

		// Token: 0x04002DF1 RID: 11761
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4002DF1")]
		public BipedReferences references;

		// Token: 0x04002DF2 RID: 11762
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4002DF2")]
		public BipedIKSolvers solvers;
	}
}
