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

namespace RootMotion.FinalIK
{
	// Token: 0x0200046D RID: 1133
	[Token(Token = "0x200046D")]
	public class HitReaction : OffsetModifier
	{
		// Token: 0x17000290 RID: 656
		// (get) Token: 0x06002897 RID: 10391 RVA: 0x00059648 File Offset: 0x00057848
		[Token(Token = "0x17000290")]
		public bool inProgress
		{
			[Token(Token = "0x6002897")]
			[Address(RVA = "0x117E910", Offset = "0x117D710", VA = "0x18117E910")]
			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: 0x06002898 RID: 10392 RVA: 0x000596AC File Offset: 0x000578AC
		[Token(Token = "0x6002898")]
		[Address(RVA = "0x117E810", Offset = "0x117D610", VA = "0x18117E810", 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: 0x06002899 RID: 10393 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002899")]
		[Address(RVA = "0x117E580", Offset = "0x117D380", VA = "0x18117E580")]
		public void Hit(Collider collider, Vector3 force, Vector3 point)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600289A RID: 10394 RVA: 0x0005974C File Offset: 0x0005794C
		[Token(Token = "0x600289A")]
		[Address(RVA = "0x8CD260", Offset = "0x8CC060", VA = "0x1808CD260")]
		public HitReaction()
		{
		}

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

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

		// Token: 0x0200046E RID: 1134
		[Token(Token = "0x200046E")]
		[Serializable]
		public abstract class HitPoint
		{
			// Token: 0x17000291 RID: 657
			// (get) Token: 0x0600289B RID: 10395 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x17000291")]
			public bool inProgress
			{
				[Token(Token = "0x600289B")]
				[Address(RVA = "0x14EAE80", Offset = "0x14E9C80", VA = "0x1814EAE80")]
				get
				{
					throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
				}
			}

			// Token: 0x17000292 RID: 658
			// (get) Token: 0x0600289C RID: 10396 RVA: 0x00059760 File Offset: 0x00057960
			// (set) Token: 0x0600289D RID: 10397 RVA: 0x00059774 File Offset: 0x00057974
			[Token(Token = "0x17000292")]
			private protected float crossFader
			{
				[Token(Token = "0x600289C")]
				[Address(RVA = "0x5B0660", Offset = "0x5AF460", VA = "0x1805B0660")]
				protected get;
				[Token(Token = "0x600289D")]
				[Address(RVA = "0x5B0700", Offset = "0x5AF500", VA = "0x1805B0700")]
				private set;
			}

			// Token: 0x17000293 RID: 659
			// (get) Token: 0x0600289E RID: 10398 RVA: 0x00059788 File Offset: 0x00057988
			// (set) Token: 0x0600289F RID: 10399 RVA: 0x0005979C File Offset: 0x0005799C
			[Token(Token = "0x17000293")]
			private protected float timer
			{
				[Token(Token = "0x600289E")]
				[Address(RVA = "0x5F9910", Offset = "0x5F8710", VA = "0x1805F9910")]
				protected get;
				[Token(Token = "0x600289F")]
				[Address(RVA = "0x5F9930", Offset = "0x5F8730", VA = "0x1805F9930")]
				private set;
			}

			// Token: 0x17000294 RID: 660
			// (get) Token: 0x060028A0 RID: 10400 RVA: 0x000020D3 File Offset: 0x000002D3
			// (set) Token: 0x060028A1 RID: 10401 RVA: 0x000597B0 File Offset: 0x000579B0
			[Token(Token = "0x17000294")]
			private protected Vector3 force
			{
				[Token(Token = "0x60028A0")]
				[Address(RVA = "0x126EB40", Offset = "0x126D940", VA = "0x18126EB40")]
				[CompilerGenerated]
				protected get
				{
					throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
				}
				[Token(Token = "0x60028A1")]
				[Address(RVA = "0x126EC30", Offset = "0x126DA30", VA = "0x18126EC30")]
				[CompilerGenerated]
				private set
				{
					float z = value.z;
					this.<force>k__BackingField.z = z;
				}
			}

			// Token: 0x17000295 RID: 661
			// (get) Token: 0x060028A2 RID: 10402 RVA: 0x000020D3 File Offset: 0x000002D3
			// (set) Token: 0x060028A3 RID: 10403 RVA: 0x000597D0 File Offset: 0x000579D0
			[Token(Token = "0x17000295")]
			private protected Vector3 point
			{
				[Token(Token = "0x60028A2")]
				[Address(RVA = "0x38DAF0", Offset = "0x38C8F0", VA = "0x18038DAF0")]
				[CompilerGenerated]
				protected get
				{
					throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
				}
				[Token(Token = "0x60028A3")]
				[Address(RVA = "0x38DB70", Offset = "0x38C970", VA = "0x18038DB70")]
				[CompilerGenerated]
				private set
				{
					float z = value.z;
					this.<point>k__BackingField.z = z;
				}
			}

			// Token: 0x060028A4 RID: 10404 RVA: 0x000597F0 File Offset: 0x000579F0
			[Token(Token = "0x60028A4")]
			[Address(RVA = "0x14EAD60", Offset = "0x14E9B60", VA = "0x1814EAD60")]
			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: 0x060028A5 RID: 10405 RVA: 0x00059874 File Offset: 0x00057A74
			[Token(Token = "0x60028A5")]
			[Address(RVA = "0x14EAC90", Offset = "0x14E9A90", VA = "0x1814EAC90")]
			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: 0x060028A6 RID: 10406
			[Token(Token = "0x60028A6")]
			[Address(Slot = "4")]
			protected abstract float GetLength();

			// Token: 0x060028A7 RID: 10407
			[Token(Token = "0x60028A7")]
			[Address(Slot = "5")]
			protected abstract void CrossFadeStart();

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

			// Token: 0x060028A9 RID: 10409 RVA: 0x000598FC File Offset: 0x00057AFC
			[Token(Token = "0x60028A9")]
			[Address(RVA = "0x14EA8B0", Offset = "0x14E96B0", VA = "0x1814EA8B0")]
			protected HitPoint()
			{
			}

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

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

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

			// Token: 0x040031E8 RID: 12776
			[FieldOffset(Offset = "0x44")]
			[Token(Token = "0x40031E8")]
			private float length;

			// Token: 0x040031E9 RID: 12777
			[FieldOffset(Offset = "0x48")]
			[Token(Token = "0x40031E9")]
			private float crossFadeSpeed;

			// Token: 0x040031EA RID: 12778
			[FieldOffset(Offset = "0x4C")]
			[Token(Token = "0x40031EA")]
			private float lastTime;
		}

		// Token: 0x0200046F RID: 1135
		[Token(Token = "0x200046F")]
		[Serializable]
		public class HitPointEffector : HitReaction.HitPoint
		{
			// Token: 0x060028AA RID: 10410 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028AA")]
			[Address(RVA = "0x14EA920", Offset = "0x14E9720", VA = "0x1814EA920", Slot = "4")]
			protected override float GetLength()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028AB RID: 10411 RVA: 0x0005991C File Offset: 0x00057B1C
			[Token(Token = "0x60028AB")]
			[Address(RVA = "0x14EA8C0", Offset = "0x14E96C0", VA = "0x1814EA8C0", 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: 0x060028AC RID: 10412 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028AC")]
			[Address(RVA = "0x14EAA70", Offset = "0x14E9870", VA = "0x1814EAA70", Slot = "6")]
			protected override void OnApply(IKSolverFullBodyBiped solver, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028AD RID: 10413 RVA: 0x00059954 File Offset: 0x00057B54
			[Token(Token = "0x60028AD")]
			[Address(RVA = "0x14EA8B0", Offset = "0x14E96B0", VA = "0x1814EA8B0")]
			public HitPointEffector()
			{
				this.crossFadeTime = 0.1f;
				base..ctor();
			}

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

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

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

			// Token: 0x02000470 RID: 1136
			[Token(Token = "0x2000470")]
			[Serializable]
			public class EffectorLink
			{
				// Token: 0x060028AE RID: 10414 RVA: 0x0003883F File Offset: 0x00036A3F
				[Token(Token = "0x60028AE")]
				[Address(RVA = "0x132C700", Offset = "0x132B500", VA = "0x18132C700")]
				public void Apply(IKSolverFullBodyBiped solver, Vector3 offset, float crossFader)
				{
				}

				// Token: 0x060028AF RID: 10415 RVA: 0x0003883F File Offset: 0x00036A3F
				[Token(Token = "0x60028AF")]
				[Address(RVA = "0x132C870", Offset = "0x132B670", VA = "0x18132C870")]
				public void CrossFadeStart()
				{
				}

				// Token: 0x060028B0 RID: 10416 RVA: 0x0003883F File Offset: 0x00036A3F
				[Token(Token = "0x60028B0")]
				[Address(RVA = "0x3D8B20", Offset = "0x3D7920", VA = "0x1803D8B20")]
				public EffectorLink()
				{
				}

				// Token: 0x040031EE RID: 12782
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x40031EE")]
				[Tooltip("The FBBIK effector type")]
				public FullBodyBipedEffector effector;

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

				// Token: 0x040031F0 RID: 12784
				[FieldOffset(Offset = "0x18")]
				[Token(Token = "0x40031F0")]
				private Vector3 lastValue;

				// Token: 0x040031F1 RID: 12785
				[FieldOffset(Offset = "0x24")]
				[Token(Token = "0x40031F1")]
				private Vector3 current;
			}
		}

		// Token: 0x02000471 RID: 1137
		[Token(Token = "0x2000471")]
		[Serializable]
		public class HitPointBone : HitReaction.HitPoint
		{
			// Token: 0x060028B1 RID: 10417 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028B1")]
			[Address(RVA = "0x14EA5B0", Offset = "0x14E93B0", VA = "0x1814EA5B0", Slot = "4")]
			protected override float GetLength()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028B2 RID: 10418 RVA: 0x00059974 File Offset: 0x00057B74
			[Token(Token = "0x60028B2")]
			[Address(RVA = "0x14EA550", Offset = "0x14E9350", VA = "0x1814EA550", 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: 0x060028B3 RID: 10419 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028B3")]
			[Address(RVA = "0x14EA650", Offset = "0x14E9450", VA = "0x1814EA650", Slot = "6")]
			protected override void OnApply(IKSolverFullBodyBiped solver, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028B4 RID: 10420 RVA: 0x000599AC File Offset: 0x00057BAC
			[Token(Token = "0x60028B4")]
			[Address(RVA = "0x14EA8B0", Offset = "0x14E96B0", VA = "0x1814EA8B0")]
			public HitPointBone()
			{
				this.crossFadeTime = 0.1f;
				base..ctor();
			}

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

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

			// Token: 0x040031F4 RID: 12788
			[FieldOffset(Offset = "0x60")]
			[Token(Token = "0x40031F4")]
			private Rigidbody rigidbody;

			// Token: 0x02000472 RID: 1138
			[Token(Token = "0x2000472")]
			[Serializable]
			public class BoneLink
			{
				// Token: 0x060028B5 RID: 10421 RVA: 0x0003883F File Offset: 0x00036A3F
				[Token(Token = "0x60028B5")]
				[Address(RVA = "0x132C590", Offset = "0x132B390", VA = "0x18132C590")]
				public void Apply(IKSolverFullBodyBiped solver, Quaternion offset, float crossFader)
				{
				}

				// Token: 0x060028B6 RID: 10422 RVA: 0x0003883F File Offset: 0x00036A3F
				[Token(Token = "0x60028B6")]
				[Address(RVA = "0x132C6B0", Offset = "0x132B4B0", VA = "0x18132C6B0")]
				public void CrossFadeStart()
				{
				}

				// Token: 0x060028B7 RID: 10423 RVA: 0x0003883F File Offset: 0x00036A3F
				[Token(Token = "0x60028B7")]
				[Address(RVA = "0x132C6C0", Offset = "0x132B4C0", VA = "0x18132C6C0")]
				public BoneLink()
				{
				}

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

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

				// Token: 0x040031F7 RID: 12791
				[FieldOffset(Offset = "0x1C")]
				[Token(Token = "0x40031F7")]
				private Quaternion lastValue;

				// Token: 0x040031F8 RID: 12792
				[FieldOffset(Offset = "0x2C")]
				[Token(Token = "0x40031F8")]
				private Quaternion current;
			}
		}
	}
}
