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

namespace RootMotion.FinalIK
{
	// Token: 0x020004CB RID: 1227
	[Token(Token = "0x20004CB")]
	public class HitReactionVRIK : OffsetModifierVRIK
	{
		// Token: 0x06002B81 RID: 11137 RVA: 0x00060D70 File Offset: 0x0005EF70
		[Token(Token = "0x6002B81")]
		[Address(RVA = "0x1704B60", Offset = "0x1703B60", VA = "0x181704B60", Slot = "4")]
		protected override void OnModifyOffset()
		{
			HitReactionVRIK.PositionOffset[] array = this.positionOffsets;
			int num = 0;
			int length = array.Length;
			if (num < length)
			{
				HitReactionVRIK.PositionOffset positionOffset = array[num];
				float weight = this.weight;
				AnimationCurve[] array2 = this.offsetCurves;
				VRIK ik = this.ik;
				positionOffset.Apply(ik, array2, weight);
				num++;
			}
			HitReactionVRIK.RotationOffset[] array3 = this.rotationOffsets;
			int length2 = array3.Length;
			if (num < length2)
			{
				HitReactionVRIK.RotationOffset rotationOffset = array3[num];
				float weight2 = this.weight;
				AnimationCurve[] array4 = this.offsetCurves;
				VRIK ik2 = this.ik;
				rotationOffset.Apply(ik2, array4, weight2);
				num++;
			}
		}

		// Token: 0x06002B82 RID: 11138 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002B82")]
		[Address(RVA = "0x17048C0", Offset = "0x17038C0", VA = "0x1817048C0")]
		public void Hit(Collider collider, Vector3 force, Vector3 point)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002B83 RID: 11139 RVA: 0x00060E10 File Offset: 0x0005F010
		[Token(Token = "0x6002B83")]
		[Address(RVA = "0xDA8200", Offset = "0xDA7200", VA = "0x180DA8200")]
		public HitReactionVRIK()
		{
		}

		// Token: 0x040034E3 RID: 13539
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40034E3")]
		public AnimationCurve[] offsetCurves;

		// Token: 0x040034E4 RID: 13540
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x40034E4")]
		[Tooltip("Hit points for the FBBIK effectors")]
		public HitReactionVRIK.PositionOffset[] positionOffsets;

		// Token: 0x040034E5 RID: 13541
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x40034E5")]
		[Tooltip(" Hit points for bones without an effector, such as the head")]
		public HitReactionVRIK.RotationOffset[] rotationOffsets;

		// Token: 0x020004CC RID: 1228
		[Token(Token = "0x20004CC")]
		[Serializable]
		public abstract class Offset
		{
			// Token: 0x170002BB RID: 699
			// (get) Token: 0x06002B84 RID: 11140 RVA: 0x00060E24 File Offset: 0x0005F024
			// (set) Token: 0x06002B85 RID: 11141 RVA: 0x00060E38 File Offset: 0x0005F038
			[Token(Token = "0x170002BB")]
			private protected float crossFader
			{
				[Token(Token = "0x6002B84")]
				[Address(RVA = "0x5C2880", Offset = "0x5C1880", VA = "0x1805C2880")]
				protected get;
				[Token(Token = "0x6002B85")]
				[Address(RVA = "0x5C2910", Offset = "0x5C1910", VA = "0x1805C2910")]
				private set;
			}

			// Token: 0x170002BC RID: 700
			// (get) Token: 0x06002B86 RID: 11142 RVA: 0x00060E4C File Offset: 0x0005F04C
			// (set) Token: 0x06002B87 RID: 11143 RVA: 0x00060E60 File Offset: 0x0005F060
			[Token(Token = "0x170002BC")]
			private protected float timer
			{
				[Token(Token = "0x6002B86")]
				[Address(RVA = "0xB94720", Offset = "0xB93720", VA = "0x180B94720")]
				protected get;
				[Token(Token = "0x6002B87")]
				[Address(RVA = "0x13B7D20", Offset = "0x13B6D20", VA = "0x1813B7D20")]
				private set;
			}

			// Token: 0x170002BD RID: 701
			// (get) Token: 0x06002B88 RID: 11144 RVA: 0x000020D3 File Offset: 0x000002D3
			// (set) Token: 0x06002B89 RID: 11145 RVA: 0x00060E74 File Offset: 0x0005F074
			[Token(Token = "0x170002BD")]
			private protected Vector3 force
			{
				[Token(Token = "0x6002B88")]
				[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 = "0x6002B89")]
				[Address(RVA = "0x1318DF0", Offset = "0x1317DF0", VA = "0x181318DF0")]
				[CompilerGenerated]
				private set
				{
					float z = value.z;
					this.<force>k__BackingField.z = z;
				}
			}

			// Token: 0x170002BE RID: 702
			// (get) Token: 0x06002B8A RID: 11146 RVA: 0x000020D3 File Offset: 0x000002D3
			// (set) Token: 0x06002B8B RID: 11147 RVA: 0x00060E94 File Offset: 0x0005F094
			[Token(Token = "0x170002BE")]
			private protected Vector3 point
			{
				[Token(Token = "0x6002B8A")]
				[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 = "0x6002B8B")]
				[Address(RVA = "0x3F6740", Offset = "0x3F5740", VA = "0x1803F6740")]
				[CompilerGenerated]
				private set
				{
					float z = value.z;
					this.<point>k__BackingField.z = z;
				}
			}

			// Token: 0x06002B8C RID: 11148 RVA: 0x00060EB4 File Offset: 0x0005F0B4
			[Token(Token = "0x6002B8C")]
			[Address(RVA = "0x16ACA60", Offset = "0x16ABA60", VA = "0x1816ACA60")]
			public void Hit(Vector3 force, AnimationCurve[] curves, Vector3 point)
			{
				int num = 0;
				float num2 = this.GetLength(curves);
				this.length = num2;
				if (num < (int)num2)
				{
					int num3 = 0;
					this.<crossFader>k__BackingField = (float)num3;
					if (this.crossFadeTime > (float)num)
					{
					}
					int num4 = 0;
					this.crossFadeSpeed = (float)num4;
					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 = (float)num3;
				}
				Debug.LogError("Hit Point WeightCurve length is zero.");
			}

			// Token: 0x06002B8D RID: 11149 RVA: 0x00060F34 File Offset: 0x0005F134
			[Token(Token = "0x6002B8D")]
			[Address(RVA = "0x16AC970", Offset = "0x16AB970", VA = "0x1816AC970")]
			public void Apply(VRIK ik, AnimationCurve[] curves, 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(ik, curves, weight);
				}
			}

			// Token: 0x06002B8E RID: 11150
			[Token(Token = "0x6002B8E")]
			[Address(Slot = "4")]
			protected abstract float GetLength(AnimationCurve[] curves);

			// Token: 0x06002B8F RID: 11151
			[Token(Token = "0x6002B8F")]
			[Address(Slot = "5")]
			protected abstract void CrossFadeStart();

			// Token: 0x06002B90 RID: 11152
			[Token(Token = "0x6002B90")]
			[Address(Slot = "6")]
			protected abstract void OnApply(VRIK ik, AnimationCurve[] curves, float weight);

			// Token: 0x06002B91 RID: 11153 RVA: 0x00060FBC File Offset: 0x0005F1BC
			[Token(Token = "0x6002B91")]
			[Address(RVA = "0x16A3700", Offset = "0x16A2700", VA = "0x1816A3700")]
			protected Offset()
			{
			}

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

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

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

			// Token: 0x040034ED RID: 13549
			[FieldOffset(Offset = "0x44")]
			[Token(Token = "0x40034ED")]
			private float length;

			// Token: 0x040034EE RID: 13550
			[FieldOffset(Offset = "0x48")]
			[Token(Token = "0x40034EE")]
			private float crossFadeSpeed;

			// Token: 0x040034EF RID: 13551
			[FieldOffset(Offset = "0x4C")]
			[Token(Token = "0x40034EF")]
			private float lastTime;
		}

		// Token: 0x020004CD RID: 1229
		[Token(Token = "0x20004CD")]
		[Serializable]
		public class PositionOffset : HitReactionVRIK.Offset
		{
			// Token: 0x06002B92 RID: 11154 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B92")]
			[Address(RVA = "0x16AD280", Offset = "0x16AC280", VA = "0x1816AD280", Slot = "4")]
			protected override float GetLength(AnimationCurve[] curves)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B93 RID: 11155 RVA: 0x00060FDC File Offset: 0x0005F1DC
			[Token(Token = "0x6002B93")]
			[Address(RVA = "0x16AD220", Offset = "0x16AC220", VA = "0x1816AD220", Slot = "5")]
			protected override void CrossFadeStart()
			{
				HitReactionVRIK.PositionOffset.PositionOffsetLink[] array = this.offsetLinks;
				int num = 0;
				int length = array.Length;
				if (num < length)
				{
					array[num].CrossFadeStart();
					num++;
				}
			}

			// Token: 0x06002B94 RID: 11156 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B94")]
			[Address(RVA = "0x16AD4A0", Offset = "0x16AC4A0", VA = "0x1816AD4A0", Slot = "6")]
			protected override void OnApply(VRIK ik, AnimationCurve[] curves, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B95 RID: 11157 RVA: 0x00061014 File Offset: 0x0005F214
			[Token(Token = "0x6002B95")]
			[Address(RVA = "0x16AD720", Offset = "0x16AC720", VA = "0x1816AD720")]
			public PositionOffset()
			{
				this.crossFadeTime = 0.1f;
				base..ctor();
			}

			// Token: 0x040034F0 RID: 13552
			[FieldOffset(Offset = "0x50")]
			[Token(Token = "0x40034F0")]
			[Tooltip("Offset magnitude in the direction of the hit force")]
			public int forceDirCurveIndex;

			// Token: 0x040034F1 RID: 13553
			[FieldOffset(Offset = "0x54")]
			[Token(Token = "0x40034F1")]
			[Tooltip("Offset magnitude in the direction of character.up")]
			public int upDirCurveIndex = (int)((ulong)1L);

			// Token: 0x040034F2 RID: 13554
			[FieldOffset(Offset = "0x58")]
			[Token(Token = "0x40034F2")]
			[Tooltip("Linking this offset to the VRIK position offsets")]
			public HitReactionVRIK.PositionOffset.PositionOffsetLink[] offsetLinks;

			// Token: 0x020004CE RID: 1230
			[Token(Token = "0x20004CE")]
			[Serializable]
			public class PositionOffsetLink
			{
				// Token: 0x06002B96 RID: 11158 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B96")]
				[Address(RVA = "0x6C89D0", Offset = "0x6C79D0", VA = "0x1806C89D0")]
				public void Apply(VRIK ik, Vector3 offset, float crossFader)
				{
				}

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

				// Token: 0x06002B98 RID: 11160 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B98")]
				[Address(RVA = "0x36ABD0", Offset = "0x369BD0", VA = "0x18036ABD0")]
				public PositionOffsetLink()
				{
				}

				// Token: 0x040034F3 RID: 13555
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x40034F3")]
				[Tooltip("The FBBIK effector type")]
				public IKSolverVR.PositionOffset positionOffset;

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

				// Token: 0x040034F5 RID: 13557
				[FieldOffset(Offset = "0x18")]
				[Token(Token = "0x40034F5")]
				private Vector3 lastValue;

				// Token: 0x040034F6 RID: 13558
				[FieldOffset(Offset = "0x24")]
				[Token(Token = "0x40034F6")]
				private Vector3 current;
			}
		}

		// Token: 0x020004CF RID: 1231
		[Token(Token = "0x20004CF")]
		[Serializable]
		public class RotationOffset : HitReactionVRIK.Offset
		{
			// Token: 0x06002B99 RID: 11161 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B99")]
			[Address(RVA = "0x16AD7A0", Offset = "0x16AC7A0", VA = "0x1816AD7A0", Slot = "4")]
			protected override float GetLength(AnimationCurve[] curves)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B9A RID: 11162 RVA: 0x0006103C File Offset: 0x0005F23C
			[Token(Token = "0x6002B9A")]
			[Address(RVA = "0x16AD740", Offset = "0x16AC740", VA = "0x1816AD740", Slot = "5")]
			protected override void CrossFadeStart()
			{
				HitReactionVRIK.RotationOffset.RotationOffsetLink[] array = this.offsetLinks;
				int num = 0;
				int length = array.Length;
				if (num < length)
				{
					array[num].CrossFadeStart();
					num++;
				}
			}

			// Token: 0x06002B9B RID: 11163 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002B9B")]
			[Address(RVA = "0x16AD8C0", Offset = "0x16AC8C0", VA = "0x1816AD8C0", Slot = "6")]
			protected override void OnApply(VRIK ik, AnimationCurve[] curves, float weight)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002B9C RID: 11164 RVA: 0x00061074 File Offset: 0x0005F274
			[Token(Token = "0x6002B9C")]
			[Address(RVA = "0x16A3700", Offset = "0x16A2700", VA = "0x1816A3700")]
			public RotationOffset()
			{
				this.crossFadeTime = 0.1f;
				base..ctor();
			}

			// Token: 0x040034F7 RID: 13559
			[FieldOffset(Offset = "0x50")]
			[Token(Token = "0x40034F7")]
			[Tooltip("The angle to rotate the bone around it's rigidbody's world center of mass")]
			public int curveIndex;

			// Token: 0x040034F8 RID: 13560
			[FieldOffset(Offset = "0x58")]
			[Token(Token = "0x40034F8")]
			[Tooltip("Linking this hit point to bone(s)")]
			public HitReactionVRIK.RotationOffset.RotationOffsetLink[] offsetLinks;

			// Token: 0x040034F9 RID: 13561
			[FieldOffset(Offset = "0x60")]
			[Token(Token = "0x40034F9")]
			private Rigidbody rigidbody;

			// Token: 0x020004D0 RID: 1232
			[Token(Token = "0x20004D0")]
			[Serializable]
			public class RotationOffsetLink
			{
				// Token: 0x06002B9D RID: 11165 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B9D")]
				[Address(RVA = "0x6CA110", Offset = "0x6C9110", VA = "0x1806CA110")]
				public void Apply(VRIK ik, Quaternion offset, float crossFader)
				{
				}

				// Token: 0x06002B9E RID: 11166 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B9E")]
				[Address(RVA = "0x6CA200", Offset = "0x6C9200", VA = "0x1806CA200")]
				public void CrossFadeStart()
				{
				}

				// Token: 0x06002B9F RID: 11167 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002B9F")]
				[Address(RVA = "0x6CA210", Offset = "0x6C9210", VA = "0x1806CA210")]
				public RotationOffsetLink()
				{
				}

				// Token: 0x040034FA RID: 13562
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x40034FA")]
				[Tooltip("Reference to the bone that this hit point rotates")]
				public IKSolverVR.RotationOffset rotationOffset;

				// Token: 0x040034FB RID: 13563
				[FieldOffset(Offset = "0x14")]
				[Token(Token = "0x40034FB")]
				[Tooltip("Weight of rotating the bone")]
				[Range(0f, 1f)]
				public float weight;

				// Token: 0x040034FC RID: 13564
				[FieldOffset(Offset = "0x18")]
				[Token(Token = "0x40034FC")]
				private Quaternion lastValue;

				// Token: 0x040034FD RID: 13565
				[FieldOffset(Offset = "0x28")]
				[Token(Token = "0x40034FD")]
				private Quaternion current;
			}
		}
	}
}
