using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x020004D1 RID: 1233
	[Token(Token = "0x20004D1")]
	public class Inertia : OffsetModifier
	{
		// Token: 0x06002BA0 RID: 11168 RVA: 0x00061094 File Offset: 0x0005F294
		[Token(Token = "0x6002BA0")]
		[Address(RVA = "0x152B390", Offset = "0x152A390", VA = "0x18152B390")]
		public void ResetBodies()
		{
			float time = Time.time;
			Inertia.Body[] array = this.bodies;
			this.lastTime = time;
			int num = 0;
			int length = array.Length;
			if (num < length)
			{
				array[num].Reset();
				num++;
			}
		}

		// Token: 0x06002BA1 RID: 11169 RVA: 0x000610DC File Offset: 0x0005F2DC
		[Token(Token = "0x6002BA1")]
		[Address(RVA = "0x152B2C0", Offset = "0x152A2C0", VA = "0x18152B2C0", Slot = "4")]
		protected override void OnModifyOffset()
		{
			Inertia.Body[] array = this.bodies;
			int num = 0;
			int length = array.Length;
			if (num < length)
			{
				Inertia.Body body = array[num];
				IKSolverFullBodyBiped solver = this.ik.solver;
				float weight = this.weight;
				float deltaTime = base.deltaTime;
				body.Update(solver, weight, deltaTime);
				num++;
			}
			OffsetModifier.OffsetLimits[] array2 = this.limits;
			base.ApplyLimits(array2);
		}

		// Token: 0x06002BA2 RID: 11170 RVA: 0x00061148 File Offset: 0x0005F348
		[Token(Token = "0x6002BA2")]
		[Address(RVA = "0xDA8200", Offset = "0xDA7200", VA = "0x180DA8200")]
		public Inertia()
		{
		}

		// Token: 0x040034FE RID: 13566
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40034FE")]
		[Tooltip("The array of Bodies")]
		public Inertia.Body[] bodies;

		// Token: 0x040034FF RID: 13567
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x40034FF")]
		[Tooltip("The array of OffsetLimits")]
		public OffsetModifier.OffsetLimits[] limits;

		// Token: 0x020004D2 RID: 1234
		[Token(Token = "0x20004D2")]
		[Serializable]
		public class Body
		{
			// Token: 0x06002BA3 RID: 11171 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BA3")]
			[Address(RVA = "0x169FAC0", Offset = "0x169EAC0", VA = "0x18169FAC0")]
			public void Reset()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BA4 RID: 11172 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BA4")]
			[Address(RVA = "0x169FBA0", Offset = "0x169EBA0", VA = "0x18169FBA0")]
			public void Update(IKSolverFullBodyBiped solver, float weight, float deltaTime)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BA5 RID: 11173 RVA: 0x0006115C File Offset: 0x0005F35C
			[Token(Token = "0x6002BA5")]
			[Address(RVA = "0x16A0100", Offset = "0x169F100", VA = "0x1816A0100")]
			public Body()
			{
			}

			// Token: 0x04003500 RID: 13568
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4003500")]
			[Tooltip("The Transform to follow, can be any bone of the character")]
			public Transform transform;

			// Token: 0x04003501 RID: 13569
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x4003501")]
			[Tooltip("Linking the body to effectors. One Body can be used to offset more than one effector")]
			public Inertia.Body.EffectorLink[] effectorLinks;

			// Token: 0x04003502 RID: 13570
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x4003502")]
			[Tooltip("The speed to follow the Transform")]
			public float speed = 10f;

			// Token: 0x04003503 RID: 13571
			[FieldOffset(Offset = "0x24")]
			[Token(Token = "0x4003503")]
			[Tooltip("The acceleration, smaller values means lazyer following")]
			public float acceleration = 3f;

			// Token: 0x04003504 RID: 13572
			[FieldOffset(Offset = "0x28")]
			[Token(Token = "0x4003504")]
			[Range(0f, 1f)]
			[Tooltip("Matching target velocity")]
			public float matchVelocity;

			// Token: 0x04003505 RID: 13573
			[FieldOffset(Offset = "0x2C")]
			[Token(Token = "0x4003505")]
			[Tooltip("gravity applied to the Body")]
			public float gravity;

			// Token: 0x04003506 RID: 13574
			[FieldOffset(Offset = "0x30")]
			[Token(Token = "0x4003506")]
			private Vector3 delta;

			// Token: 0x04003507 RID: 13575
			[FieldOffset(Offset = "0x3C")]
			[Token(Token = "0x4003507")]
			private Vector3 lazyPoint;

			// Token: 0x04003508 RID: 13576
			[FieldOffset(Offset = "0x48")]
			[Token(Token = "0x4003508")]
			private Vector3 direction;

			// Token: 0x04003509 RID: 13577
			[FieldOffset(Offset = "0x54")]
			[Token(Token = "0x4003509")]
			private Vector3 lastPosition;

			// Token: 0x0400350A RID: 13578
			[FieldOffset(Offset = "0x60")]
			[Token(Token = "0x400350A")]
			private bool firstUpdate = true;

			// Token: 0x020004D3 RID: 1235
			[Token(Token = "0x20004D3")]
			[Serializable]
			public class EffectorLink
			{
				// Token: 0x06002BA6 RID: 11174 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002BA6")]
				[Address(RVA = "0x36ABD0", Offset = "0x369BD0", VA = "0x18036ABD0")]
				public EffectorLink()
				{
				}

				// Token: 0x0400350B RID: 13579
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x400350B")]
				[Tooltip("Type of the FBBIK effector to use")]
				public FullBodyBipedEffector effector;

				// Token: 0x0400350C RID: 13580
				[FieldOffset(Offset = "0x14")]
				[Token(Token = "0x400350C")]
				[Tooltip("Weight of using this effector")]
				public float weight;
			}
		}
	}
}
