using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x0200040C RID: 1036
	[Token(Token = "0x200040C")]
	public class IKExecutionOrder : MonoBehaviour
	{
		// Token: 0x17000227 RID: 551
		// (get) Token: 0x0600251A RID: 9498 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x17000227")]
		private bool animatePhysics
		{
			[Token(Token = "0x600251A")]
			[Address(RVA = "0x1182C70", Offset = "0x1181A70", VA = "0x181182C70")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x0600251B RID: 9499 RVA: 0x00053ED0 File Offset: 0x000520D0
		[Token(Token = "0x600251B")]
		[Address(RVA = "0x1182BC0", Offset = "0x11819C0", VA = "0x181182BC0")]
		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: 0x0600251C RID: 9500 RVA: 0x00053F14 File Offset: 0x00052114
		[Token(Token = "0x600251C")]
		[Address(RVA = "0x1182C40", Offset = "0x1181A40", VA = "0x181182C40")]
		private void Update()
		{
			if (!this.animatePhysics)
			{
				this.FixTransforms();
				return;
			}
		}

		// Token: 0x0600251D RID: 9501 RVA: 0x00053F34 File Offset: 0x00052134
		[Token(Token = "0x600251D")]
		[Address(RVA = "0x1182A70", Offset = "0x1181870", VA = "0x181182A70")]
		private void FixedUpdate()
		{
			this.fixedFrame = true;
			if (this.animatePhysics)
			{
				this.FixTransforms();
				return;
			}
		}

		// Token: 0x0600251E RID: 9502 RVA: 0x00053F58 File Offset: 0x00052158
		[Token(Token = "0x600251E")]
		[Address(RVA = "0x1182AA0", Offset = "0x11818A0", VA = "0x181182AA0")]
		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: 0x0600251F RID: 9503 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600251F")]
		[Address(RVA = "0x11829C0", Offset = "0x11817C0", VA = "0x1811829C0")]
		private void FixTransforms()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002520 RID: 9504 RVA: 0x00054000 File Offset: 0x00052200
		[Token(Token = "0x6002520")]
		[Address(RVA = "0x3088F0", Offset = "0x3076F0", VA = "0x1803088F0")]
		public IKExecutionOrder()
		{
		}

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

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

		// Token: 0x04002EA1 RID: 11937
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002EA1")]
		private bool fixedFrame;
	}
}
