using System;
using System.Runtime.CompilerServices;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x020004C5 RID: 1221
	[Token(Token = "0x20004C5")]
	public class HitReaction : OffsetModifier
	{
		// Token: 0x170002B5 RID: 693
		// (get) Token: 0x06002B60 RID: 11104 RVA: 0x000609EC File Offset: 0x0005EBEC
		[Token(Token = "0x170002B5")]
		public bool inProgress
		{
			[Token(Token = "0x6002B60")]
			[Address(RVA = "0x1704FE0", Offset = "0x1703FE0", VA = "0x181704FE0")]
			get
			{
				HitReaction.HitPointEffector[] array = this.effectorHitPoints;
				int num = 0;
				int length = array.Length;
				if (num < length)
				{
					if (array[num].inProgress)
					{
						return true;
					}
					num++;
				}
				HitReaction.HitPointBone[] array2 = this.boneHitPoints;
				int length2 = array2.Length;
				if (num >= length2)
				{
					throw new NullReferenceException();
				}
				if (!array2[num].inProgress)
				{
					num++;
				}
				return true;
			}
		}

		// Token: 0x06002B61 RID: 11105 RVA: 0x00060A50 File Offset: 0x0005EC50
		[Token(Token = "0x6002B61")]
		[Address(RVA = "0x1704EE0", Offset = "0x1703EE0", VA = "0x181704EE0", Slot = "4")]
		protected override void OnModifyOffset()
		{
			HitReaction.HitPointEffector[] array = this.effectorHitPoints;
			int num = 0;
			int length = array.Length;
			if (num < length)
			{
				FullBodyBipedIK ik = this.ik;
				HitReaction.HitPointEffector hitPointEffector = array[num];
				float weight = this.weight;
				IKSolverFullBodyBiped solver = ik.solver;
				hitPointEffector.Apply(solver, weight);
				num++;
			}
			HitReaction.HitPointBone[] array2 = this.boneHitPoints;
			int length2 = array2.Length;
			if (num < length2)
			{
				FullBodyBipedIK ik2 = this.ik;
				HitReaction.HitPointBone hitPointBone = array2[num];
				float weight2 = this.weight;
				IKSolverFullBodyBiped solver2 = ik2.solver;
				hitPointBone.Apply(solver2, weight2);
				num++;
			}
		}

		// Token: 0x06002B62 RID: 11106 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002B62")]
		[Address(RVA = "0x1704C50", Offset = "0x1703C50", VA = "0x181704C50")]
		public void Hit(Collider collider, Vector3 force, Vector3 point)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002B63 RID: 11107 RVA: 0x00060AF0 File Offset: 0x0005ECF0
		[Token(Token = "0x6002B63")]
		[Address(RVA = "0xDA8200", Offset = "0xDA7200", VA = "0x180DA8200")]
		public HitReaction()
		{
		}

		// Token: 0x040034C9 RID: 13513
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40034C9")]
		[Tooltip("Hit points for the FBBIK effectors")]
		public HitReaction.HitPointEffector[] effectorHitPoints;

		// Token: 0x040034CA RID: 13514
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x40034CA")]
		[Tooltip(" Hit points for bones without an effector, such as the head")]
		public HitReaction.HitPointBone[] boneHitPoints;

		// Token: 0x020004C6 RID: 1222
		[Token(Token = "0x20004C6")]
		[Serializable]
		public abstract class HitPoint
		{
			// Token: 0x170002B6 RID: 694
			// (get) Token: 0x06002B64 RID: 11108 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x170002B6")]
			public bool inProgress
			{
				[Token(Token = "0x6002B64")]
				[Address(RVA = "0x16A3CD0", Offset = "0x16A2CD0", VA = "0x1816A3CD0")]
				get
				{
					throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
				}
			}

			// Token: 0x170002B7 RID: 695
			// (get) Token: 0x06002B65 RID: 11109 RVA: 0x00060B04 File Offset: 0x0005ED04
			// (set) Token: 0x06002B66 RID: 11110 RVA: 0x00060B18 File Offset: 0x0005ED18
			[Token(Token = "0x170002B7")]
			private protected float crossFader
			{
				[Token(Token = "0x6002B65")]
				[Address(RVA = "0x5C2880", Offset = "0x5C1880", VA = "0x1805C2880")]
				protected get;
				[Token(Token = "0x6002B66")]
				[Address(RVA = "0x5C2910", Offset = "0x5C1910", VA = "0x1805C2910")]
				private set;
			}

			// Token: 0x170002B8 RID: 696
			// (get) Token: 0x06002B67 RID: 11111 RVA: 0x00060B2C File Offset: 0x0005ED2C
			// (set) Token: 0x06002B68 RID: 11112 RVA: 0x00060B40 File Offset: 0x0005ED40
			[Token(Token = "0x170002B8")]
			private protected float timer
			{
				[Token(Token = "0x6002B67")]
				[Address(RVA = "0xB94720", Offset = "0xB93720", VA = "0x180B94720")]
				protected get;
				[Token(Token = "0x6002B68")]
				[Address(RVA = "0x13B7D20", Offset = "0x13B6D20", VA = "0x1813B7D20")]
				private set;
			}

			// Token: 0x170002B9 RID: 697
			// (get) Token: 0x06002B69 RID: 11113 RVA: 0x000020D3 File Offset: 0x000002D3
			// (set) Token: 0x06002B6A RID: 11114 RVA: 0x00060B54 File Offset: 0x0005ED54
			[Token(Token = "0x170002B9")]
			private protected Vector3 force
			{
				[Token(Token = "0x6002B69")]
				[Address(RVA = "0x1318D00", Offset = "0x1317D00", VA = "0x181318D00")]
				[CompilerGenerated]
				protected get
				{
					throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
				}
				[Token(Token = "0x6002B6A")]
				[Address(RVA = "0x1318DF0", Offset = "0x1317DF0", VA = "0x181318DF0")]
				[CompilerGenerated]
				private set
				{
					float z = value.z;
					this.<force>k__BackingField.z = z;
				}
			}

			// Token: 0x170002BA RID: 698
			// (get) Token: 0x06002B6B RID: 11115 RVA: 0x000020D3 File Offset: 0x000002D3
			// (set) Token: 0x06002B6C RID: 11116 RVA: 0x00060B74 File Offset: 0x0005ED74
			[Token(Token = "0x170002BA")]
			private protected Vector3 point
			{
				[Token(Token = "0x6002B6B")]
				[Address(RVA = "0x3F66C0", Offset = "0x3F56C0", VA = "0x1803F66C0")]
				[CompilerGenerated]
				protected get
				{
					throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
				}
				[Token(Token = "0x6002B6C")]
				[Address(RVA = "0x3F6740", Offset = "0x3F5740", VA = "0x1803F6740")]
				[CompilerGenerated]
				private set
				{
					float z = value.z;
					this.<point>k__BackingField.z = z;
				}
			}

			// Token: 0x06002B6D RID: 11117 RVA: 0x00060B94 File Offset: 0x0005ED94
			[Token(Token = "0x6002B6D")]
			[Address(RVA = "0x16A3BB0", Offset = "0x16A2BB0", VA = "0x1816A3BB0")]
			public void Hit(Vector3 force, Vector3 point)
			{
				int num = 0;
				float num2 = this.GetLength();
				this.length = num2;
				if (num < (int)num2)
				{
					this.<crossFader>k__BackingField = 0f;
					if (this.crossFadeTime > (float)num)
					{
					}
					int num3 = 0;
					this.crossFadeSpeed = (float)num3;
					this.CrossFadeStart();
					float z = force.z;
					this.<force>k__BackingField.z = z;
					float z2 = point.z;
					this.<point>k__BackingField.z = z2;
					this.<timer>k__BackingField = 0f;
				}
				Debug.LogError("Hit Point WeightCurve length is zero.");
			}

			// Token: 0x06002B6E RID: 11118 RVA: 0x00060C18 File Offset: 0x0005EE18
			[Token(Token = "0x6002B6E")]
			[Address(RVA = "0x16A3AE0", Offset = "0x16A2AE0", VA = "0x1816A3AE0")]
			public void Apply(IKSolverFullBodyBiped solver, float weight)
			{
				float time = Time.time;
				float time2 = Time.time;
				float num = this.length;
				this.lastTime = time2;
				float num2 = this.<timer>k__BackingField;
				if (num2 < num)
				{
					int num3 = 0;
					int num4 = 0;
					float num5 = Mathf.Clamp(num2, (float)num3, num);
					this.<timer>k__BackingField = num5;
					float num6 = this.crossFadeSpeed;
					if (num6 <= (float)num4)
					{
					}
					int num7 = 0;
					float num8 = Mathf.Clamp(num6, (float)num7, 1f);
					this.<crossFader>k__BackingField = num8;
					this.OnApply(solver, weight);
				}
			}

			// Token: 0x06002B6F RID: 11119
			[Token(Token = "0x6002B6F")]
			[Address(Slot = "4")]
			protected abstract float GetLength();

			// Token: 0x06002B70 RID: 11120
			[Token(Token = "0x6002B70")]
			[Address(Slot = "5")]
			protected abstract void CrossFadeStart();

			// Token: 0x06002B71 RID: 11121
			[Token(Token = "0x6002B71")]
			[Address(Slot = "6")]
			protected abstract void OnApply(IKSolverFullBodyBiped solver, float weight);

			// Token: 0x06002B72 RID: 11122 RVA: 0x00060CA0 File Offset: 0x0005EEA0
			[Token(Token = "0x6002B72")]
			[Address(RVA = "0x16A3700", Offset = "0x16A2700", VA = "0x1816A3700")]
			protected HitPoint()
			{
			}

			// Token: 0x040034CB RID: 13515
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x40034CB")]
			[Tooltip("Just for visual clarity, not used at all")]
			public string name;

			// Token: 0x040034CC RID: 13516
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x40034CC")]
			[Tooltip("Linking this hit point to a collider")]
			public Collider collider;

			// Token: 0x040034CD RID: 13517
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x40034CD")]
			[SerializeField]
			[Tooltip("Only used if this hit point gets hit when already processing another hit")]
			private float crossFadeTime = 0.1f;

			// Token: 0x040034D2 RID: 13522
			[FieldOffset(Offset = "0x44")]
			[Token(Token = "0x40034D2")]
			private float length;

			// Token: 0x040034D3 RID: 13523
			[FieldOffset(Offset = "0x48")]
			[Token(Token = "0x40034D3")]
			private float crossFadeSpeed;

			// Token: 0x040034D4 RID: 13524
			[FieldOffset(Offset = "0x4C")]
			[Token(Token = "0x40034D4")]
			private float lastTime;
		}

		// Token: 0x020004C7 RID: 1223
		[Token(Token = "0x20004C7")]
		[Serializable]
		public class HitPointEffector : HitReaction.HitPoint
		{
			// Token: 0x06002B73 RID: 11123 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B73")]
			[Address(RVA = "0x16A3770", Offset = "0x16A2770", VA = "0x1816A3770", Slot = "4")]
			protected override float GetLength()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B74 RID: 11124 RVA: 0x00060CC0 File Offset: 0x0005EEC0
			[Token(Token = "0x6002B74")]
			[Address(RVA = "0x16A3710", Offset = "0x16A2710", VA = "0x1816A3710", Slot = "5")]
			protected override void CrossFadeStart()
			{
				HitReaction.HitPointEffector.EffectorLink[] array = this.effectorLinks;
				int num = 0;
				int length = array.Length;
				if (num < length)
				{
					array[num].CrossFadeStart();
					num++;
				}
			}

			// Token: 0x06002B75 RID: 11125 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B75")]
			[Address(RVA = "0x16A38C0", Offset = "0x16A28C0", VA = "0x1816A38C0", Slot = "6")]
			protected override void OnApply(IKSolverFullBodyBiped solver, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B76 RID: 11126 RVA: 0x00060CF8 File Offset: 0x0005EEF8
			[Token(Token = "0x6002B76")]
			[Address(RVA = "0x16A3700", Offset = "0x16A2700", VA = "0x1816A3700")]
			public HitPointEffector()
			{
				this.crossFadeTime = 0.1f;
				base..ctor();
			}

			// Token: 0x040034D5 RID: 13525
			[FieldOffset(Offset = "0x50")]
			[Token(Token = "0x40034D5")]
			[Tooltip("Offset magnitude in the direction of the hit force")]
			public AnimationCurve offsetInForceDirection;

			// Token: 0x040034D6 RID: 13526
			[FieldOffset(Offset = "0x58")]
			[Token(Token = "0x40034D6")]
			[Tooltip("Offset magnitude in the direction of character.up")]
			public AnimationCurve offsetInUpDirection;

			// Token: 0x040034D7 RID: 13527
			[FieldOffset(Offset = "0x60")]
			[Token(Token = "0x40034D7")]
			[Tooltip("Linking this offset to the FBBIK effectors")]
			public HitReaction.HitPointEffector.EffectorLink[] effectorLinks;

			// Token: 0x020004C8 RID: 1224
			[Token(Token = "0x20004C8")]
			[Serializable]
			public class EffectorLink
			{
				// Token: 0x06002B77 RID: 11127 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B77")]
				[Address(RVA = "0x6C6740", Offset = "0x6C5740", VA = "0x1806C6740")]
				public void Apply(IKSolverFullBodyBiped solver, Vector3 offset, float crossFader)
				{
				}

				// Token: 0x06002B78 RID: 11128 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B78")]
				[Address(RVA = "0x6C68B0", Offset = "0x6C58B0", VA = "0x1806C68B0")]
				public void CrossFadeStart()
				{
				}

				// Token: 0x06002B79 RID: 11129 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B79")]
				[Address(RVA = "0x36ABD0", Offset = "0x369BD0", VA = "0x18036ABD0")]
				public EffectorLink()
				{
				}

				// Token: 0x040034D8 RID: 13528
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x40034D8")]
				[Tooltip("The FBBIK effector type")]
				public FullBodyBipedEffector effector;

				// Token: 0x040034D9 RID: 13529
				[FieldOffset(Offset = "0x14")]
				[Token(Token = "0x40034D9")]
				[Tooltip("The weight of this effector (could also be negative)")]
				public float weight;

				// Token: 0x040034DA RID: 13530
				[FieldOffset(Offset = "0x18")]
				[Token(Token = "0x40034DA")]
				private Vector3 lastValue;

				// Token: 0x040034DB RID: 13531
				[FieldOffset(Offset = "0x24")]
				[Token(Token = "0x40034DB")]
				private Vector3 current;
			}
		}

		// Token: 0x020004C9 RID: 1225
		[Token(Token = "0x20004C9")]
		[Serializable]
		public class HitPointBone : HitReaction.HitPoint
		{
			// Token: 0x06002B7A RID: 11130 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B7A")]
			[Address(RVA = "0x16A3400", Offset = "0x16A2400", VA = "0x1816A3400", Slot = "4")]
			protected override float GetLength()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B7B RID: 11131 RVA: 0x00060D18 File Offset: 0x0005EF18
			[Token(Token = "0x6002B7B")]
			[Address(RVA = "0x16A33A0", Offset = "0x16A23A0", VA = "0x1816A33A0", Slot = "5")]
			protected override void CrossFadeStart()
			{
				HitReaction.HitPointBone.BoneLink[] array = this.boneLinks;
				int num = 0;
				int length = array.Length;
				if (num < length)
				{
					array[num].CrossFadeStart();
					num++;
				}
			}

			// Token: 0x06002B7C RID: 11132 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B7C")]
			[Address(RVA = "0x16A34A0", Offset = "0x16A24A0", VA = "0x1816A34A0", Slot = "6")]
			protected override void OnApply(IKSolverFullBodyBiped solver, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B7D RID: 11133 RVA: 0x00060D50 File Offset: 0x0005EF50
			[Token(Token = "0x6002B7D")]
			[Address(RVA = "0x16A3700", Offset = "0x16A2700", VA = "0x1816A3700")]
			public HitPointBone()
			{
				this.crossFadeTime = 0.1f;
				base..ctor();
			}

			// Token: 0x040034DC RID: 13532
			[FieldOffset(Offset = "0x50")]
			[Token(Token = "0x40034DC")]
			[Tooltip("The angle to rotate the bone around it's rigidbody's world center of mass")]
			public AnimationCurve aroundCenterOfMass;

			// Token: 0x040034DD RID: 13533
			[FieldOffset(Offset = "0x58")]
			[Token(Token = "0x40034DD")]
			[Tooltip("Linking this hit point to bone(s)")]
			public HitReaction.HitPointBone.BoneLink[] boneLinks;

			// Token: 0x040034DE RID: 13534
			[FieldOffset(Offset = "0x60")]
			[Token(Token = "0x40034DE")]
			private Rigidbody rigidbody;

			// Token: 0x020004CA RID: 1226
			[Token(Token = "0x20004CA")]
			[Serializable]
			public class BoneLink
			{
				// Token: 0x06002B7E RID: 11134 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B7E")]
				[Address(RVA = "0x6C65D0", Offset = "0x6C55D0", VA = "0x1806C65D0")]
				public void Apply(IKSolverFullBodyBiped solver, Quaternion offset, float crossFader)
				{
				}

				// Token: 0x06002B7F RID: 11135 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B7F")]
				[Address(RVA = "0x6C66F0", Offset = "0x6C56F0", VA = "0x1806C66F0")]
				public void CrossFadeStart()
				{
				}

				// Token: 0x06002B80 RID: 11136 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B80")]
				[Address(RVA = "0x6C6700", Offset = "0x6C5700", VA = "0x1806C6700")]
				public BoneLink()
				{
				}

				// Token: 0x040034DF RID: 13535
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x40034DF")]
				[Tooltip("Reference to the bone that this hit point rotates")]
				public Transform bone;

				// Token: 0x040034E0 RID: 13536
				[FieldOffset(Offset = "0x18")]
				[Token(Token = "0x40034E0")]
				[Tooltip("Weight of rotating the bone")]
				[Range(0f, 1f)]
				public float weight;

				// Token: 0x040034E1 RID: 13537
				[FieldOffset(Offset = "0x1C")]
				[Token(Token = "0x40034E1")]
				private Quaternion lastValue;

				// Token: 0x040034E2 RID: 13538
				[FieldOffset(Offset = "0x2C")]
				[Token(Token = "0x40034E2")]
				private Quaternion current;
			}
		}
	}
}
