using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000464 RID: 1124
	[Token(Token = "0x2000464")]
	public class IKExecutionOrder : MonoBehaviour
	{
		// Token: 0x1700024C RID: 588
		// (get) Token: 0x060027E3 RID: 10211 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x1700024C")]
		private bool animatePhysics
		{
			[Token(Token = "0x60027E3")]
			[Address(RVA = "0x1709340", Offset = "0x1708340", VA = "0x181709340")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x060027E4 RID: 10212 RVA: 0x0005B22C File Offset: 0x0005942C
		[Token(Token = "0x60027E4")]
		[Address(RVA = "0x1709290", Offset = "0x1708290", VA = "0x181709290")]
		private void Start()
		{
			IK[] ikcomponents = this.IKComponents;
			int num = 0;
			if (num < ikcomponents.Length)
			{
				IK ik = ikcomponents[num];
				int num2 = 0;
				ik.enabled = num2 != 0;
				IK[] ikcomponents2 = this.IKComponents;
				num++;
			}
		}

		// Token: 0x060027E5 RID: 10213 RVA: 0x0005B270 File Offset: 0x00059470
		[Token(Token = "0x60027E5")]
		[Address(RVA = "0x1709310", Offset = "0x1708310", VA = "0x181709310")]
		private void Update()
		{
			if (!this.animatePhysics)
			{
				this.FixTransforms();
				return;
			}
		}

		// Token: 0x060027E6 RID: 10214 RVA: 0x0005B290 File Offset: 0x00059490
		[Token(Token = "0x60027E6")]
		[Address(RVA = "0x1709140", Offset = "0x1708140", VA = "0x181709140")]
		private void FixedUpdate()
		{
			this.fixedFrame = true;
			if (this.animatePhysics)
			{
				this.FixTransforms();
				return;
			}
		}

		// Token: 0x060027E7 RID: 10215 RVA: 0x0005B2B4 File Offset: 0x000594B4
		[Token(Token = "0x60027E7")]
		[Address(RVA = "0x1709170", Offset = "0x1708170", VA = "0x181709170")]
		private void LateUpdate()
		{
			if (!this.animatePhysics || this.fixedFrame)
			{
				IK[] ikcomponents = this.IKComponents;
				int num = 0;
				if (num < ikcomponents.Length)
				{
					IKSolver iksolver = ikcomponents[num].GetIKSolver();
					IKSolver.UpdateDelegate onPreUpdate = iksolver.OnPreUpdate;
					if (onPreUpdate != 0)
					{
						onPreUpdate();
					}
					if (iksolver.firstInitiation)
					{
						Transform root = iksolver.root;
						iksolver.Initiate(root);
					}
					if (iksolver.<initiated>k__BackingField)
					{
						iksolver.OnUpdate();
						IKSolver.UpdateDelegate onPostUpdate = iksolver.OnPostUpdate;
						if (onPostUpdate != 0)
						{
							onPostUpdate();
						}
					}
					IK[] ikcomponents2 = this.IKComponents;
					num++;
				}
				this.fixedFrame = false;
			}
		}

		// Token: 0x060027E8 RID: 10216 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60027E8")]
		[Address(RVA = "0x1709090", Offset = "0x1708090", VA = "0x181709090")]
		private void FixTransforms()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060027E9 RID: 10217 RVA: 0x0005B35C File Offset: 0x0005955C
		[Token(Token = "0x60027E9")]
		[Address(RVA = "0x328C40", Offset = "0x327C40", VA = "0x180328C40")]
		public IKExecutionOrder()
		{
		}

		// Token: 0x04003189 RID: 12681
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003189")]
		[Tooltip("The IK components, assign in the order in which you wish to update them.")]
		public IK[] IKComponents;

		// Token: 0x0400318A RID: 12682
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x400318A")]
		[Tooltip("Optional. Assign it if you are using 'Animate Physics' as the Update Mode.")]
		public Animator animator;

		// Token: 0x0400318B RID: 12683
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x400318B")]
		private bool fixedFrame;
	}
}
