using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000415 RID: 1045
	[Token(Token = "0x2000415")]
	public class FBBIKHeadEffector : MonoBehaviour
	{
		// Token: 0x06002550 RID: 9552 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002550")]
		[Address(RVA = "0xA6BF50", Offset = "0xA6AD50", VA = "0x180A6BF50")]
		private void Awake()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002551 RID: 9553 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002551")]
		[Address(RVA = "0xA6F010", Offset = "0xA6DE10", VA = "0x180A6F010")]
		private void OnStoreDefaultLocalState()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002552 RID: 9554 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002552")]
		[Address(RVA = "0xA6DE90", Offset = "0xA6CC90", VA = "0x180A6DE90")]
		private void OnFixTransforms()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002553 RID: 9555 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002553")]
		[Address(RVA = "0xA6E630", Offset = "0xA6D430", VA = "0x180A6E630")]
		private void OnPreRead()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002554 RID: 9556 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002554")]
		[Address(RVA = "0xA6FC90", Offset = "0xA6EA90", VA = "0x180A6FC90")]
		private void SpineBend()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002555 RID: 9557 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002555")]
		[Address(RVA = "0xA6C370", Offset = "0xA6B170", VA = "0x180A6C370")]
		private void CCDPass()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002556 RID: 9558 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002556")]
		[Address(RVA = "0xA6CAB0", Offset = "0xA6B8B0", VA = "0x180A6CAB0")]
		private void Iterate(int iteration)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002557 RID: 9559 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002557")]
		[Address(RVA = "0xA6E410", Offset = "0xA6D210", VA = "0x180A6E410")]
		private void OnPostUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002558 RID: 9560 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002558")]
		[Address(RVA = "0xA6C810", Offset = "0xA6B610", VA = "0x180A6C810")]
		private void ChestDirection()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002559 RID: 9561 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002559")]
		[Address(RVA = "0xA6F6D0", Offset = "0xA6E4D0", VA = "0x180A6F6D0")]
		private void PostStretching()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600255A RID: 9562 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600255A")]
		[Address(RVA = "0xA6D920", Offset = "0xA6C720", VA = "0x180A6D920")]
		private void LerpSolverPosition(IKEffector effector, Vector3 position, float weight, Vector3 offset)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600255B RID: 9563 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600255B")]
		[Address(RVA = "0xA6FB00", Offset = "0xA6E900", VA = "0x180A6FB00")]
		private void Solve(ref Vector3 pos1, ref Vector3 pos2, float nominalDistance)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600255C RID: 9564 RVA: 0x0005463C File Offset: 0x0005283C
		[Token(Token = "0x600255C")]
		[Address(RVA = "0xA6DAF0", Offset = "0xA6C8F0", VA = "0x180A6DAF0")]
		private void OnDestroy()
		{
			FullBodyBipedIK fullBodyBipedIK = this.ik;
			int num = 0;
			if (fullBodyBipedIK != num)
			{
				IKSolverFullBodyBiped solver = this.ik.solver;
				IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.OnPreRead);
				Delegate @delegate = Delegate.Remove(updateDelegate, updateDelegate);
				int num2 = 0;
				if (@delegate == 0 || @delegate != 0)
				{
					solver.OnPreRead = num2;
					IKSolverFullBodyBiped solver2 = this.ik.solver;
					IKSolver.IterationDelegate iterationDelegate = new IKSolver.IterationDelegate(this.Iterate);
					Delegate delegate2 = Delegate.Remove(iterationDelegate, iterationDelegate);
					if (delegate2 == 0 || delegate2 != 0)
					{
						solver2.OnPreIteration = delegate2;
						IKSolverFullBodyBiped solver3 = this.ik.solver;
						IKSolver.UpdateDelegate onPostUpdate = solver3.OnPostUpdate;
						IKSolver.UpdateDelegate updateDelegate2 = new IKSolver.UpdateDelegate(this.OnPostUpdate);
						Delegate delegate3 = Delegate.Remove(onPostUpdate, updateDelegate2);
						if (delegate3 == 0 || delegate3 != 0)
						{
							solver3.OnPostUpdate = delegate3;
							IKSolverFullBodyBiped solver4 = this.ik.solver;
							IKSolver.UpdateDelegate updateDelegate3 = new IKSolver.UpdateDelegate(this.OnStoreDefaultLocalState);
							Delegate delegate4 = Delegate.Remove(onPostUpdate, updateDelegate3);
							if (delegate4 == 0 || delegate4 != 0)
							{
								solver4.OnStoreDefaultLocalState = delegate4;
								IKSolverFullBodyBiped solver5 = this.ik.solver;
								IKSolver.UpdateDelegate onFixTransforms = solver5.OnFixTransforms;
								IKSolver.UpdateDelegate updateDelegate4 = new IKSolver.UpdateDelegate(this.OnFixTransforms);
								Delegate delegate5 = Delegate.Remove(onFixTransforms, updateDelegate4);
								if (delegate5 == 0 || delegate5 != 0)
								{
									solver5.OnFixTransforms = delegate5;
									return;
								}
							}
						}
					}
				}
				throw new InvalidCastException();
			}
		}

		// Token: 0x0600255D RID: 9565 RVA: 0x000547A4 File Offset: 0x000529A4
		[Token(Token = "0x600255D")]
		[Address(RVA = "0xA70060", Offset = "0xA6EE60", VA = "0x180A70060")]
		public FBBIKHeadEffector()
		{
			int num = 0;
			this.bodyWeight = 0.8f;
			this.thighWeight = 0.8f;
			this.handsPullBody = true;
			this.bodyClampWeight = 0.5f;
			this.headClampWeight = 0.5f;
			this.bendWeight = 1f;
			FBBIKHeadEffector.BendBone[] array = new FBBIKHeadEffector.BendBone[num];
			this.bendBones = array;
			this.CCDWeight = 1f;
			int num2 = 0;
			this.damper = 500f;
			Transform[] array2 = new Transform[num2];
			this.CCDBones = array2;
			this.postStretchWeight = 1f;
			int num3 = 0;
			this.maxStretch = 0.1f;
			Transform[] array3 = new Transform[num3];
			this.stretchBones = array3;
			Vector3 forward = Vector3.forward;
			int num4 = 0;
			float z = forward.z;
			this.chestDirection.z = z;
			this.chestDirectionWeight = 1f;
			Transform[] array4 = new Transform[num4];
			this.chestBones = array4;
			Quaternion[] array5 = new Quaternion[0];
			this.ccdDefaultLocalRotations = array5;
			Vector3[] array6 = new Vector3[0];
			this.stretchLocalPositions = array6;
			Quaternion[] array7 = new Quaternion[0];
			this.stretchLocalRotations = array7;
			Vector3[] array8 = new Vector3[0];
			this.chestLocalPositions = array8;
			Quaternion[] array9 = new Quaternion[0];
			this.chestLocalRotations = array9;
			base..ctor();
		}

		// Token: 0x04002ECA RID: 11978
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4002ECA")]
		[Tooltip("Reference to the FBBIK component.")]
		public FullBodyBipedIK ik;

		// Token: 0x04002ECB RID: 11979
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4002ECB")]
		[LargeHeader("Position")]
		[Tooltip("Master weight for positioning the head.")]
		[Range(0f, 1f)]
		public float positionWeight = 1f;

		// Token: 0x04002ECC RID: 11980
		[FieldOffset(Offset = "0x24")]
		[Token(Token = "0x4002ECC")]
		[Range(0f, 1f)]
		[Tooltip("The weight of moving the body along with the head")]
		public float bodyWeight;

		// Token: 0x04002ECD RID: 11981
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002ECD")]
		[Tooltip("The weight of moving the thighs along with the head")]
		[Range(0f, 1f)]
		public float thighWeight;

		// Token: 0x04002ECE RID: 11982
		[FieldOffset(Offset = "0x2C")]
		[Token(Token = "0x4002ECE")]
		[Tooltip("If false, hands will not pull the head away if they are too far. Disabling this will improve performance significantly.")]
		public bool handsPullBody;

		// Token: 0x04002ECF RID: 11983
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4002ECF")]
		[LargeHeader("Rotation")]
		[Tooltip("The weight of rotating the head bone after solving")]
		[Range(0f, 1f)]
		public float rotationWeight;

		// Token: 0x04002ED0 RID: 11984
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x4002ED0")]
		[Tooltip("Clamping the rotation of the body")]
		[Range(0f, 1f)]
		public float bodyClampWeight;

		// Token: 0x04002ED1 RID: 11985
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4002ED1")]
		[Range(0f, 1f)]
		[Tooltip("Clamping the rotation of the head")]
		public float headClampWeight;

		// Token: 0x04002ED2 RID: 11986
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x4002ED2")]
		[Range(0f, 1f)]
		[Tooltip("The master weight of bending/twisting the spine to the rotation of the head effector. This is similar to CCD, but uses the rotation of the head effector not the position.")]
		public float bendWeight;

		// Token: 0x04002ED3 RID: 11987
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4002ED3")]
		[Tooltip("The bones to use for bending.")]
		public FBBIKHeadEffector.BendBone[] bendBones;

		// Token: 0x04002ED4 RID: 11988
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4002ED4")]
		[LargeHeader("CCD")]
		[Range(0f, 1f)]
		[Tooltip("Optional. The master weight of the CCD (Cyclic Coordinate Descent) IK effect that bends the spine towards the head effector before FBBIK solves.")]
		public float CCDWeight;

		// Token: 0x04002ED5 RID: 11989
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x4002ED5")]
		[Range(0f, 1f)]
		[Tooltip("The weight of rolling the bones in towards the target")]
		public float roll;

		// Token: 0x04002ED6 RID: 11990
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4002ED6")]
		[Range(0f, 1000f)]
		[Tooltip("Smoothing the CCD effect.")]
		public float damper;

		// Token: 0x04002ED7 RID: 11991
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4002ED7")]
		[Tooltip("Bones to use for the CCD pass. Assign spine and/or neck bones.")]
		public Transform[] CCDBones;

		// Token: 0x04002ED8 RID: 11992
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4002ED8")]
		[Tooltip("Stretching the spine/neck to help reach the target. This is useful for making sure the head stays locked relative to the VR headset. NB! Stretching is done after FBBIK has solved so if you have the hand effectors pinned and spine bones included in the 'Stretch Bones', the hands might become offset from their target positions.")]
		[Range(0f, 1f)]
		[LargeHeader("Stretching")]
		public float postStretchWeight;

		// Token: 0x04002ED9 RID: 11993
		[FieldOffset(Offset = "0x64")]
		[Token(Token = "0x4002ED9")]
		[Tooltip("Stretch magnitude limit.")]
		public float maxStretch;

		// Token: 0x04002EDA RID: 11994
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x4002EDA")]
		[Tooltip("If > 0, dampers the stretching effect.")]
		public float stretchDamper;

		// Token: 0x04002EDB RID: 11995
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x4002EDB")]
		[Tooltip("If true, will fix head position to this Transform no matter what. Good for making sure the head will not budge away from the VR headset")]
		public bool fixHead;

		// Token: 0x04002EDC RID: 11996
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x4002EDC")]
		[Tooltip("Bones to use for stretching. The more bones you add, the less noticable the effect.")]
		public Transform[] stretchBones;

		// Token: 0x04002EDD RID: 11997
		[FieldOffset(Offset = "0x78")]
		[Token(Token = "0x4002EDD")]
		[LargeHeader("Chest Direction")]
		public Vector3 chestDirection;

		// Token: 0x04002EDE RID: 11998
		[FieldOffset(Offset = "0x84")]
		[Token(Token = "0x4002EDE")]
		[Range(0f, 1f)]
		public float chestDirectionWeight;

		// Token: 0x04002EDF RID: 11999
		[FieldOffset(Offset = "0x88")]
		[Token(Token = "0x4002EDF")]
		public Transform[] chestBones;

		// Token: 0x04002EE0 RID: 12000
		[FieldOffset(Offset = "0x90")]
		[Token(Token = "0x4002EE0")]
		public IKSolver.UpdateDelegate OnPostHeadEffectorFK;

		// Token: 0x04002EE1 RID: 12001
		[FieldOffset(Offset = "0x98")]
		[Token(Token = "0x4002EE1")]
		private Vector3 offset;

		// Token: 0x04002EE2 RID: 12002
		[FieldOffset(Offset = "0xA4")]
		[Token(Token = "0x4002EE2")]
		private Vector3 headToBody;

		// Token: 0x04002EE3 RID: 12003
		[FieldOffset(Offset = "0xB0")]
		[Token(Token = "0x4002EE3")]
		private Vector3 shoulderCenterToHead;

		// Token: 0x04002EE4 RID: 12004
		[FieldOffset(Offset = "0xBC")]
		[Token(Token = "0x4002EE4")]
		private Vector3 headToLeftThigh;

		// Token: 0x04002EE5 RID: 12005
		[FieldOffset(Offset = "0xC8")]
		[Token(Token = "0x4002EE5")]
		private Vector3 headToRightThigh;

		// Token: 0x04002EE6 RID: 12006
		[FieldOffset(Offset = "0xD4")]
		[Token(Token = "0x4002EE6")]
		private Vector3 leftShoulderPos;

		// Token: 0x04002EE7 RID: 12007
		[FieldOffset(Offset = "0xE0")]
		[Token(Token = "0x4002EE7")]
		private Vector3 rightShoulderPos;

		// Token: 0x04002EE8 RID: 12008
		[FieldOffset(Offset = "0xEC")]
		[Token(Token = "0x4002EE8")]
		private float shoulderDist;

		// Token: 0x04002EE9 RID: 12009
		[FieldOffset(Offset = "0xF0")]
		[Token(Token = "0x4002EE9")]
		private float leftShoulderDist;

		// Token: 0x04002EEA RID: 12010
		[FieldOffset(Offset = "0xF4")]
		[Token(Token = "0x4002EEA")]
		private float rightShoulderDist;

		// Token: 0x04002EEB RID: 12011
		[FieldOffset(Offset = "0xF8")]
		[Token(Token = "0x4002EEB")]
		private Quaternion chestRotation;

		// Token: 0x04002EEC RID: 12012
		[FieldOffset(Offset = "0x108")]
		[Token(Token = "0x4002EEC")]
		private Quaternion headRotationRelativeToRoot;

		// Token: 0x04002EED RID: 12013
		[FieldOffset(Offset = "0x118")]
		[Token(Token = "0x4002EED")]
		private Quaternion[] ccdDefaultLocalRotations;

		// Token: 0x04002EEE RID: 12014
		[FieldOffset(Offset = "0x120")]
		[Token(Token = "0x4002EEE")]
		private Vector3 headLocalPosition;

		// Token: 0x04002EEF RID: 12015
		[FieldOffset(Offset = "0x12C")]
		[Token(Token = "0x4002EEF")]
		private Quaternion headLocalRotation;

		// Token: 0x04002EF0 RID: 12016
		[FieldOffset(Offset = "0x140")]
		[Token(Token = "0x4002EF0")]
		private Vector3[] stretchLocalPositions;

		// Token: 0x04002EF1 RID: 12017
		[FieldOffset(Offset = "0x148")]
		[Token(Token = "0x4002EF1")]
		private Quaternion[] stretchLocalRotations;

		// Token: 0x04002EF2 RID: 12018
		[FieldOffset(Offset = "0x150")]
		[Token(Token = "0x4002EF2")]
		private Vector3[] chestLocalPositions;

		// Token: 0x04002EF3 RID: 12019
		[FieldOffset(Offset = "0x158")]
		[Token(Token = "0x4002EF3")]
		private Quaternion[] chestLocalRotations;

		// Token: 0x04002EF4 RID: 12020
		[FieldOffset(Offset = "0x160")]
		[Token(Token = "0x4002EF4")]
		private int bendBonesCount;

		// Token: 0x04002EF5 RID: 12021
		[FieldOffset(Offset = "0x164")]
		[Token(Token = "0x4002EF5")]
		private int ccdBonesCount;

		// Token: 0x04002EF6 RID: 12022
		[FieldOffset(Offset = "0x168")]
		[Token(Token = "0x4002EF6")]
		private int stretchBonesCount;

		// Token: 0x04002EF7 RID: 12023
		[FieldOffset(Offset = "0x16C")]
		[Token(Token = "0x4002EF7")]
		private int chestBonesCount;

		// Token: 0x02000416 RID: 1046
		[Token(Token = "0x2000416")]
		[Serializable]
		public class BendBone
		{
			// Token: 0x0600255E RID: 9566 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x600255E")]
			[Address(RVA = "0x5F8B60", Offset = "0x5F7960", VA = "0x1805F8B60")]
			public BendBone()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x0600255F RID: 9567 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x600255F")]
			[Address(RVA = "0x5F8B00", Offset = "0x5F7900", VA = "0x1805F8B00")]
			public BendBone(Transform transform, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002560 RID: 9568 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002560")]
			[Address(RVA = "0x5F8AC0", Offset = "0x5F78C0", VA = "0x1805F8AC0")]
			public void StoreDefaultLocalState()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002561 RID: 9569 RVA: 0x000548EC File Offset: 0x00052AEC
			[Token(Token = "0x6002561")]
			[Address(RVA = "0x5F8A80", Offset = "0x5F7880", VA = "0x1805F8A80")]
			public void FixTransforms()
			{
				Transform transform = this.transform;
				Quaternion quaternion = this.defaultLocalRotation;
				transform.localRotation = quaternion;
			}

			// Token: 0x04002EF8 RID: 12024
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4002EF8")]
			[Tooltip("Assign spine and/or neck bones.")]
			public Transform transform;

			// Token: 0x04002EF9 RID: 12025
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x4002EF9")]
			[Tooltip("The weight of rotating this bone.")]
			[Range(0f, 1f)]
			public float weight;

			// Token: 0x04002EFA RID: 12026
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x4002EFA")]
			private Quaternion defaultLocalRotation;
		}
	}
}
