using System;
using System.Collections;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x020004D4 RID: 1236
	[Token(Token = "0x20004D4")]
	public abstract class OffsetModifier : MonoBehaviour
	{
		// Token: 0x170002BF RID: 703
		// (get) Token: 0x06002BA7 RID: 11175 RVA: 0x0006118C File Offset: 0x0005F38C
		[Token(Token = "0x170002BF")]
		protected float deltaTime
		{
			[Token(Token = "0x6002BA7")]
			[Address(RVA = "0xE69600", Offset = "0xE68600", VA = "0x180E69600")]
			get
			{
				return Time.time;
			}
		}

		// Token: 0x06002BA8 RID: 11176
		[Token(Token = "0x6002BA8")]
		[Address(Slot = "4")]
		protected abstract void OnModifyOffset();

		// Token: 0x06002BA9 RID: 11177 RVA: 0x000611A0 File Offset: 0x0005F3A0
		[Token(Token = "0x6002BA9")]
		[Address(RVA = "0xE69980", Offset = "0xE68980", VA = "0x180E69980", Slot = "5")]
		protected virtual void Start()
		{
			int num;
			OffsetModifier.<Initiate>d__8 <Initiate>d__ = new OffsetModifier.<Initiate>d__8(num);
			num = 0;
			<Initiate>d__.<>4__this = this;
			Coroutine coroutine = base.StartCoroutine(<Initiate>d__);
		}

		// Token: 0x06002BAA RID: 11178 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BAA")]
		[Address(RVA = "0xE69710", Offset = "0xE68710", VA = "0x180E69710")]
		private IEnumerator Initiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BAB RID: 11179 RVA: 0x000611CC File Offset: 0x0005F3CC
		[Token(Token = "0x6002BAB")]
		[Address(RVA = "0xE69780", Offset = "0xE68780", VA = "0x180E69780")]
		private void ModifyOffset()
		{
			if (base.enabled)
			{
				int num = 0;
				if (num < (int)this.weight)
				{
					float time = Time.time;
					if (num < (int)time)
					{
						FullBodyBipedIK fullBodyBipedIK = this.ik;
						int num2 = 0;
						if (!(fullBodyBipedIK == num2))
						{
							float num3 = this.weight;
							int num4 = 0;
							float num5 = Mathf.Clamp(num3, (float)num4, 1f);
							this.weight = num5;
							this.OnModifyOffset();
							float time2 = Time.time;
							this.lastTime = time2;
						}
					}
				}
			}
		}

		// Token: 0x06002BAC RID: 11180 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BAC")]
		[Address(RVA = "0xE69620", Offset = "0xE68620", VA = "0x180E69620")]
		protected void ApplyLimits(OffsetModifier.OffsetLimits[] limits)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BAD RID: 11181 RVA: 0x0006124C File Offset: 0x0005F44C
		[Token(Token = "0x6002BAD")]
		[Address(RVA = "0xE69860", Offset = "0xE68860", VA = "0x180E69860", Slot = "6")]
		protected virtual void OnDestroy()
		{
			FullBodyBipedIK fullBodyBipedIK = this.ik;
			int num = 0;
			if (fullBodyBipedIK != num)
			{
				IKSolverFullBodyBiped solver = this.ik.solver;
				IKSolver.UpdateDelegate onPreUpdate = solver.OnPreUpdate;
				IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.ModifyOffset);
				Delegate @delegate = Delegate.Remove(onPreUpdate, updateDelegate);
				int num2 = 0;
				if (@delegate != 0 && @delegate == 0)
				{
					throw new InvalidCastException();
				}
				solver.OnPreUpdate = num2;
			}
		}

		// Token: 0x06002BAE RID: 11182 RVA: 0x000612B8 File Offset: 0x0005F4B8
		[Token(Token = "0x6002BAE")]
		[Address(RVA = "0x503840", Offset = "0x502840", VA = "0x180503840")]
		protected OffsetModifier()
		{
		}

		// Token: 0x0400350D RID: 13581
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x400350D")]
		[Tooltip("The master weight")]
		public float weight = 1f;

		// Token: 0x0400350E RID: 13582
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x400350E")]
		[Tooltip("Reference to the FBBIK component")]
		public FullBodyBipedIK ik;

		// Token: 0x0400350F RID: 13583
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x400350F")]
		protected float lastTime;

		// Token: 0x020004D5 RID: 1237
		[Token(Token = "0x20004D5")]
		[Serializable]
		public class OffsetLimits
		{
			// Token: 0x06002BAF RID: 11183 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BAF")]
			[Address(RVA = "0x69A130", Offset = "0x699130", VA = "0x18069A130")]
			public void Apply(IKEffector e, Quaternion rootRotation)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BB0 RID: 11184 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BB0")]
			[Address(RVA = "0x69A300", Offset = "0x699300", VA = "0x18069A300")]
			private float SpringAxis(float value, float min, float max)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BB1 RID: 11185 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BB1")]
			[Address(RVA = "0x69A380", Offset = "0x699380", VA = "0x18069A380")]
			private float Spring(float value, float limit, bool negative)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BB2 RID: 11186 RVA: 0x000612D8 File Offset: 0x0005F4D8
			[Token(Token = "0x6002BB2")]
			[Address(RVA = "0x36ABD0", Offset = "0x369BD0", VA = "0x18036ABD0")]
			public OffsetLimits()
			{
			}

			// Token: 0x04003510 RID: 13584
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4003510")]
			[Tooltip("The effector type (this is just an enum)")]
			public FullBodyBipedEffector effector;

			// Token: 0x04003511 RID: 13585
			[FieldOffset(Offset = "0x14")]
			[Token(Token = "0x4003511")]
			[Tooltip("Spring force, if zero then this is a hard limit, if not, offset can exceed the limit.")]
			public float spring;

			// Token: 0x04003512 RID: 13586
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x4003512")]
			[Tooltip("Which axes to limit the offset on?")]
			public bool x;

			// Token: 0x04003513 RID: 13587
			[FieldOffset(Offset = "0x19")]
			[Token(Token = "0x4003513")]
			[Tooltip("Which axes to limit the offset on?")]
			public bool y;

			// Token: 0x04003514 RID: 13588
			[FieldOffset(Offset = "0x1A")]
			[Token(Token = "0x4003514")]
			[Tooltip("Which axes to limit the offset on?")]
			public bool z;

			// Token: 0x04003515 RID: 13589
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x4003515")]
			[Tooltip("The limits")]
			public float minX;

			// Token: 0x04003516 RID: 13590
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x4003516")]
			[Tooltip("The limits")]
			public float maxX;

			// Token: 0x04003517 RID: 13591
			[FieldOffset(Offset = "0x24")]
			[Token(Token = "0x4003517")]
			[Tooltip("The limits")]
			public float minY;

			// Token: 0x04003518 RID: 13592
			[FieldOffset(Offset = "0x28")]
			[Token(Token = "0x4003518")]
			[Tooltip("The limits")]
			public float maxY;

			// Token: 0x04003519 RID: 13593
			[FieldOffset(Offset = "0x2C")]
			[Token(Token = "0x4003519")]
			[Tooltip("The limits")]
			public float minZ;

			// Token: 0x0400351A RID: 13594
			[FieldOffset(Offset = "0x30")]
			[Token(Token = "0x400351A")]
			[Tooltip("The limits")]
			public float maxZ;
		}
	}
}
