using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000449 RID: 1097
	[Token(Token = "0x2000449")]
	[Serializable]
	public class BipedIKSolvers
	{
		// Token: 0x17000230 RID: 560
		// (get) Token: 0x06002701 RID: 9985 RVA: 0x00059D38 File Offset: 0x00057F38
		[Token(Token = "0x17000230")]
		public IKSolverLimb[] limbs
		{
			[Token(Token = "0x6002701")]
			[Address(RVA = "0x7A0C80", Offset = "0x79FC80", VA = "0x1807A0C80")]
			get
			{
				IKSolverLimb[] limbs;
				IKSolverLimb[] array;
				IKSolverLimb iksolverLimb4;
				for (;;)
				{
					limbs = this._limbs;
					if (limbs != 0 && limbs.Length == 4)
					{
						return limbs;
					}
					array = new IKSolverLimb[4];
					IKSolverLimb iksolverLimb = this.leftFoot;
					if (iksolverLimb == 0 || array != 0)
					{
						array[0] = iksolverLimb;
						IKSolverLimb iksolverLimb2 = this.rightFoot;
						if (iksolverLimb2 == 0 || array != 0)
						{
							array[1] = iksolverLimb2;
							IKSolverLimb iksolverLimb3 = this.leftHand;
							if (iksolverLimb3 == 0 || array != 0)
							{
								array[2] = iksolverLimb3;
								iksolverLimb4 = this.rightHand;
								if (iksolverLimb4 == 0 || array != 0)
								{
									break;
								}
							}
						}
					}
				}
				array[3] = iksolverLimb4;
				this._limbs = array;
				return limbs;
			}
		}

		// Token: 0x17000231 RID: 561
		// (get) Token: 0x06002702 RID: 9986 RVA: 0x00059DD4 File Offset: 0x00057FD4
		[Token(Token = "0x17000231")]
		public IKSolver[] ikSolvers
		{
			[Token(Token = "0x6002702")]
			[Address(RVA = "0x7A0970", Offset = "0x79F970", VA = "0x1807A0970")]
			get
			{
				IKSolver[] ikSolvers;
				IKSolver[] array;
				IKSolverAim iksolverAim;
				for (;;)
				{
					ikSolvers = this._ikSolvers;
					if (ikSolvers != 0 && ikSolvers.Length == 7)
					{
						return ikSolvers;
					}
					array = new IKSolver[7];
					IKSolverLimb iksolverLimb = this.leftFoot;
					if (iksolverLimb == 0 || array != 0)
					{
						array[0] = iksolverLimb;
						IKSolverLimb iksolverLimb2 = this.rightFoot;
						if (iksolverLimb2 == 0 || array != 0)
						{
							array[1] = iksolverLimb2;
							IKSolverLimb iksolverLimb3 = this.leftHand;
							if (iksolverLimb3 == 0 || array != 0)
							{
								array[2] = iksolverLimb3;
								IKSolverLimb iksolverLimb4 = this.rightHand;
								if (iksolverLimb4 == 0 || array != 0)
								{
									array[3] = iksolverLimb4;
									IKSolverFABRIK iksolverFABRIK = this.spine;
									if (iksolverFABRIK == 0 || array != 0)
									{
										array[4] = iksolverFABRIK;
										IKSolverLookAt iksolverLookAt = this.lookAt;
										if (iksolverLookAt == 0 || array != 0)
										{
											array[5] = iksolverLookAt;
											iksolverAim = this.aim;
											if (iksolverAim == 0 || array != 0)
											{
												break;
											}
										}
									}
								}
							}
						}
					}
				}
				array[6] = iksolverAim;
				this._ikSolvers = array;
				return ikSolvers;
			}
		}

		// Token: 0x06002703 RID: 9987 RVA: 0x00059EC8 File Offset: 0x000580C8
		[Token(Token = "0x6002703")]
		[Address(RVA = "0x7A0610", Offset = "0x79F610", VA = "0x1807A0610")]
		public void AssignReferences(BipedReferences references)
		{
			IKSolverLimb iksolverLimb = this.leftHand;
			Transform root = references.root;
			int num = 0;
			Transform transform = references.leftHand;
			Transform leftForearm = references.leftForearm;
			Transform leftUpperArm = references.leftUpperArm;
			bool flag = iksolverLimb.SetChain(leftUpperArm, leftForearm, transform, root);
			IKSolverLimb iksolverLimb2 = this.rightHand;
			Transform root2 = references.root;
			Transform transform2 = references.rightHand;
			Transform rightForearm = references.rightForearm;
			Transform rightUpperArm = references.rightUpperArm;
			bool flag2 = iksolverLimb2.SetChain(rightUpperArm, rightForearm, transform2, root2);
			IKSolverLimb iksolverLimb3 = this.leftFoot;
			Transform root3 = references.root;
			Transform transform3 = references.leftFoot;
			Transform leftCalf = references.leftCalf;
			Transform leftThigh = references.leftThigh;
			bool flag3 = iksolverLimb3.SetChain(leftThigh, leftCalf, transform3, root3);
			IKSolverLimb iksolverLimb4 = this.rightFoot;
			Transform root4 = references.root;
			Transform transform4 = references.rightFoot;
			Transform rightCalf = references.rightCalf;
			Transform rightThigh = references.rightThigh;
			bool flag4 = iksolverLimb4.SetChain(rightThigh, rightCalf, transform4, root4);
			IKSolverFABRIK iksolverFABRIK = this.spine;
			Transform root5 = references.root;
			Transform[] array = references.spine;
			bool flag5 = iksolverFABRIK.SetChain(array, root5);
			IKSolverLookAt iksolverLookAt = this.lookAt;
			Transform root6 = references.root;
			Transform[] eyes = references.eyes;
			Transform head = references.head;
			Transform[] array2 = references.spine;
			bool flag6 = iksolverLookAt.SetChain(array2, head, eyes, root6);
			IKSolverAim iksolverAim = this.aim;
			Transform root7 = references.root;
			Transform[] array3 = references.spine;
			bool flag7 = iksolverAim.SetChain(array3, root7);
			this.leftFoot.goal = (AvatarIKGoal)num;
			this.rightFoot.goal = (AvatarIKGoal)((ulong)1L);
			this.leftHand.goal = (AvatarIKGoal)((ulong)2L);
			this.rightHand.goal = (AvatarIKGoal)((ulong)3L);
		}

		// Token: 0x06002704 RID: 9988 RVA: 0x0005A074 File Offset: 0x00058274
		[Token(Token = "0x6002704")]
		[Address(RVA = "0x7A07B0", Offset = "0x79F7B0", VA = "0x1807A07B0")]
		public BipedIKSolvers()
		{
			int num;
			IKSolverLimb iksolverLimb = new IKSolverLimb((AvatarIKGoal)num);
			num = 0;
			this.leftFoot = iksolverLimb;
			IKSolverLimb iksolverLimb2 = new IKSolverLimb(AvatarIKGoal.RightFoot);
			this.rightFoot = iksolverLimb2;
			IKSolverLimb iksolverLimb3 = new IKSolverLimb(AvatarIKGoal.LeftHand);
			this.leftHand = iksolverLimb3;
			IKSolverLimb iksolverLimb4 = new IKSolverLimb(AvatarIKGoal.RightHand);
			this.rightHand = iksolverLimb4;
			IKSolverFABRIK iksolverFABRIK = new IKSolverFABRIK();
			this.spine = iksolverFABRIK;
			IKSolverLookAt iksolverLookAt = new IKSolverLookAt();
			this.lookAt = iksolverLookAt;
			IKSolverAim iksolverAim = new IKSolverAim();
			this.aim = iksolverAim;
			Constraints constraints = new Constraints();
			this.pelvis = constraints;
			base..ctor();
		}

		// Token: 0x040030DD RID: 12509
		[FieldOffset(Offset = "0x10")]
		[Token(Token = "0x40030DD")]
		public IKSolverLimb leftFoot;

		// Token: 0x040030DE RID: 12510
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x40030DE")]
		public IKSolverLimb rightFoot;

		// Token: 0x040030DF RID: 12511
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x40030DF")]
		public IKSolverLimb leftHand;

		// Token: 0x040030E0 RID: 12512
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x40030E0")]
		public IKSolverLimb rightHand;

		// Token: 0x040030E1 RID: 12513
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40030E1")]
		public IKSolverFABRIK spine;

		// Token: 0x040030E2 RID: 12514
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x40030E2")]
		public IKSolverLookAt lookAt;

		// Token: 0x040030E3 RID: 12515
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x40030E3")]
		public IKSolverAim aim;

		// Token: 0x040030E4 RID: 12516
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x40030E4")]
		public Constraints pelvis;

		// Token: 0x040030E5 RID: 12517
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x40030E5")]
		private IKSolverLimb[] _limbs;

		// Token: 0x040030E6 RID: 12518
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x40030E6")]
		private IKSolver[] _ikSolvers;
	}
}
