using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x0200046D RID: 1133
	[Token(Token = "0x200046D")]
	public class FBBIKHeadEffector : MonoBehaviour
	{
		// Token: 0x06002819 RID: 10265 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002819")]
		[Address(RVA = "0xD0F330", Offset = "0xD0E330", VA = "0x180D0F330")]
		private void Awake()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600281A RID: 10266 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600281A")]
		[Address(RVA = "0xD123F0", Offset = "0xD113F0", VA = "0x180D123F0")]
		private void OnStoreDefaultLocalState()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600281B RID: 10267 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600281B")]
		[Address(RVA = "0xD11270", Offset = "0xD10270", VA = "0x180D11270")]
		private void OnFixTransforms()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600281C RID: 10268 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600281C")]
		[Address(RVA = "0xD11A10", Offset = "0xD10A10", VA = "0x180D11A10")]
		private void OnPreRead()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600281D RID: 10269 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600281D")]
		[Address(RVA = "0xD13070", Offset = "0xD12070", VA = "0x180D13070")]
		private void SpineBend()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600281E RID: 10270 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600281E")]
		[Address(RVA = "0xD0F750", Offset = "0xD0E750", VA = "0x180D0F750")]
		private void CCDPass()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600281F RID: 10271 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x600281F")]
		[Address(RVA = "0xD0FE90", Offset = "0xD0EE90", VA = "0x180D0FE90")]
		private void Iterate(int iteration)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002820 RID: 10272 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002820")]
		[Address(RVA = "0xD117F0", Offset = "0xD107F0", VA = "0x180D117F0")]
		private void OnPostUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002821 RID: 10273 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002821")]
		[Address(RVA = "0xD0FBF0", Offset = "0xD0EBF0", VA = "0x180D0FBF0")]
		private void ChestDirection()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002822 RID: 10274 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002822")]
		[Address(RVA = "0xD12AB0", Offset = "0xD11AB0", VA = "0x180D12AB0")]
		private void PostStretching()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002823 RID: 10275 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002823")]
		[Address(RVA = "0xD10D00", Offset = "0xD0FD00", VA = "0x180D10D00")]
		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: 0x06002824 RID: 10276 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002824")]
		[Address(RVA = "0xD12EE0", Offset = "0xD11EE0", VA = "0x180D12EE0")]
		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: 0x06002825 RID: 10277 RVA: 0x0005B998 File Offset: 0x00059B98
		[Token(Token = "0x6002825")]
		[Address(RVA = "0xD10ED0", Offset = "0xD0FED0", VA = "0x180D10ED0")]
		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: 0x06002826 RID: 10278 RVA: 0x0005BB00 File Offset: 0x00059D00
		[Token(Token = "0x6002826")]
		[Address(RVA = "0xD13440", Offset = "0xD12440", VA = "0x180D13440")]
		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: 0x040031B4 RID: 12724
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x40031B4")]
		[Tooltip("Reference to the FBBIK component.")]
		public FullBodyBipedIK ik;

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

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

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

		// Token: 0x040031B8 RID: 12728
		[FieldOffset(Offset = "0x2C")]
		[Token(Token = "0x40031B8")]
		[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: 0x040031B9 RID: 12729
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40031B9")]
		[LargeHeader("Rotation")]
		[Tooltip("The weight of rotating the head bone after solving")]
		[Range(0f, 1f)]
		public float rotationWeight;

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

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

		// Token: 0x040031BC RID: 12732
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x40031BC")]
		[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.")]
		[Range(0f, 1f)]
		public float bendWeight;

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

		// Token: 0x040031BE RID: 12734
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x40031BE")]
		[Range(0f, 1f)]
		[LargeHeader("CCD")]
		[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: 0x040031BF RID: 12735
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x40031BF")]
		[Tooltip("The weight of rolling the bones in towards the target")]
		[Range(0f, 1f)]
		public float roll;

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

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

		// Token: 0x040031C2 RID: 12738
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x40031C2")]
		[LargeHeader("Stretching")]
		[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)]
		public float postStretchWeight;

		// Token: 0x040031C3 RID: 12739
		[FieldOffset(Offset = "0x64")]
		[Token(Token = "0x40031C3")]
		[Tooltip("Stretch magnitude limit.")]
		public float maxStretch;

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

		// Token: 0x040031C5 RID: 12741
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x40031C5")]
		[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: 0x040031C6 RID: 12742
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x40031C6")]
		[Tooltip("Bones to use for stretching. The more bones you add, the less noticable the effect.")]
		public Transform[] stretchBones;

		// Token: 0x040031C7 RID: 12743
		[FieldOffset(Offset = "0x78")]
		[Token(Token = "0x40031C7")]
		[LargeHeader("Chest Direction")]
		public Vector3 chestDirection;

		// Token: 0x040031C8 RID: 12744
		[FieldOffset(Offset = "0x84")]
		[Token(Token = "0x40031C8")]
		[Range(0f, 1f)]
		public float chestDirectionWeight;

		// Token: 0x040031C9 RID: 12745
		[FieldOffset(Offset = "0x88")]
		[Token(Token = "0x40031C9")]
		public Transform[] chestBones;

		// Token: 0x040031CA RID: 12746
		[FieldOffset(Offset = "0x90")]
		[Token(Token = "0x40031CA")]
		public IKSolver.UpdateDelegate OnPostHeadEffectorFK;

		// Token: 0x040031CB RID: 12747
		[FieldOffset(Offset = "0x98")]
		[Token(Token = "0x40031CB")]
		private Vector3 offset;

		// Token: 0x040031CC RID: 12748
		[FieldOffset(Offset = "0xA4")]
		[Token(Token = "0x40031CC")]
		private Vector3 headToBody;

		// Token: 0x040031CD RID: 12749
		[FieldOffset(Offset = "0xB0")]
		[Token(Token = "0x40031CD")]
		private Vector3 shoulderCenterToHead;

		// Token: 0x040031CE RID: 12750
		[FieldOffset(Offset = "0xBC")]
		[Token(Token = "0x40031CE")]
		private Vector3 headToLeftThigh;

		// Token: 0x040031CF RID: 12751
		[FieldOffset(Offset = "0xC8")]
		[Token(Token = "0x40031CF")]
		private Vector3 headToRightThigh;

		// Token: 0x040031D0 RID: 12752
		[FieldOffset(Offset = "0xD4")]
		[Token(Token = "0x40031D0")]
		private Vector3 leftShoulderPos;

		// Token: 0x040031D1 RID: 12753
		[FieldOffset(Offset = "0xE0")]
		[Token(Token = "0x40031D1")]
		private Vector3 rightShoulderPos;

		// Token: 0x040031D2 RID: 12754
		[FieldOffset(Offset = "0xEC")]
		[Token(Token = "0x40031D2")]
		private float shoulderDist;

		// Token: 0x040031D3 RID: 12755
		[FieldOffset(Offset = "0xF0")]
		[Token(Token = "0x40031D3")]
		private float leftShoulderDist;

		// Token: 0x040031D4 RID: 12756
		[FieldOffset(Offset = "0xF4")]
		[Token(Token = "0x40031D4")]
		private float rightShoulderDist;

		// Token: 0x040031D5 RID: 12757
		[FieldOffset(Offset = "0xF8")]
		[Token(Token = "0x40031D5")]
		private Quaternion chestRotation;

		// Token: 0x040031D6 RID: 12758
		[FieldOffset(Offset = "0x108")]
		[Token(Token = "0x40031D6")]
		private Quaternion headRotationRelativeToRoot;

		// Token: 0x040031D7 RID: 12759
		[FieldOffset(Offset = "0x118")]
		[Token(Token = "0x40031D7")]
		private Quaternion[] ccdDefaultLocalRotations;

		// Token: 0x040031D8 RID: 12760
		[FieldOffset(Offset = "0x120")]
		[Token(Token = "0x40031D8")]
		private Vector3 headLocalPosition;

		// Token: 0x040031D9 RID: 12761
		[FieldOffset(Offset = "0x12C")]
		[Token(Token = "0x40031D9")]
		private Quaternion headLocalRotation;

		// Token: 0x040031DA RID: 12762
		[FieldOffset(Offset = "0x140")]
		[Token(Token = "0x40031DA")]
		private Vector3[] stretchLocalPositions;

		// Token: 0x040031DB RID: 12763
		[FieldOffset(Offset = "0x148")]
		[Token(Token = "0x40031DB")]
		private Quaternion[] stretchLocalRotations;

		// Token: 0x040031DC RID: 12764
		[FieldOffset(Offset = "0x150")]
		[Token(Token = "0x40031DC")]
		private Vector3[] chestLocalPositions;

		// Token: 0x040031DD RID: 12765
		[FieldOffset(Offset = "0x158")]
		[Token(Token = "0x40031DD")]
		private Quaternion[] chestLocalRotations;

		// Token: 0x040031DE RID: 12766
		[FieldOffset(Offset = "0x160")]
		[Token(Token = "0x40031DE")]
		private int bendBonesCount;

		// Token: 0x040031DF RID: 12767
		[FieldOffset(Offset = "0x164")]
		[Token(Token = "0x40031DF")]
		private int ccdBonesCount;

		// Token: 0x040031E0 RID: 12768
		[FieldOffset(Offset = "0x168")]
		[Token(Token = "0x40031E0")]
		private int stretchBonesCount;

		// Token: 0x040031E1 RID: 12769
		[FieldOffset(Offset = "0x16C")]
		[Token(Token = "0x40031E1")]
		private int chestBonesCount;

		// Token: 0x0200046E RID: 1134
		[Token(Token = "0x200046E")]
		[Serializable]
		public class BendBone
		{
			// Token: 0x06002827 RID: 10279 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002827")]
			[Address(RVA = "0x19BBD00", Offset = "0x19BAD00", VA = "0x1819BBD00")]
			public BendBone()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002828 RID: 10280 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002828")]
			[Address(RVA = "0x19BBCA0", Offset = "0x19BACA0", VA = "0x1819BBCA0")]
			public BendBone(Transform transform, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002829 RID: 10281 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002829")]
			[Address(RVA = "0x19BBC60", Offset = "0x19BAC60", VA = "0x1819BBC60")]
			public void StoreDefaultLocalState()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x0600282A RID: 10282 RVA: 0x0005BC48 File Offset: 0x00059E48
			[Token(Token = "0x600282A")]
			[Address(RVA = "0x19BBC20", Offset = "0x19BAC20", VA = "0x1819BBC20")]
			public void FixTransforms()
			{
				Transform transform = this.transform;
				Quaternion quaternion = this.defaultLocalRotation;
				transform.localRotation = quaternion;
			}

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

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

			// Token: 0x040031E4 RID: 12772
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x40031E4")]
			private Quaternion defaultLocalRotation;
		}
	}
}
