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

namespace RootMotion.FinalIK
{
	// Token: 0x0200047C RID: 1148
	[Token(Token = "0x200047C")]
	public abstract class OffsetModifier : MonoBehaviour
	{
		// Token: 0x1700029A RID: 666
		// (get) Token: 0x060028DE RID: 10462 RVA: 0x00059DE8 File Offset: 0x00057FE8
		[Token(Token = "0x1700029A")]
		protected float deltaTime
		{
			[Token(Token = "0x60028DE")]
			[Address(RVA = "0xD38330", Offset = "0xD37130", VA = "0x180D38330")]
			get
			{
				return Time.time;
			}
		}

		// Token: 0x060028DF RID: 10463
		[Token(Token = "0x60028DF")]
		[Address(Slot = "4")]
		protected abstract void OnModifyOffset();

		// Token: 0x060028E0 RID: 10464 RVA: 0x00059DFC File Offset: 0x00057FFC
		[Token(Token = "0x60028E0")]
		[Address(RVA = "0xD386B0", Offset = "0xD374B0", VA = "0x180D386B0", 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: 0x060028E1 RID: 10465 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60028E1")]
		[Address(RVA = "0xD38440", Offset = "0xD37240", VA = "0x180D38440")]
		private IEnumerator Initiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060028E2 RID: 10466 RVA: 0x00059E28 File Offset: 0x00058028
		[Token(Token = "0x60028E2")]
		[Address(RVA = "0xD384B0", Offset = "0xD372B0", VA = "0x180D384B0")]
		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: 0x060028E3 RID: 10467 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60028E3")]
		[Address(RVA = "0xD38350", Offset = "0xD37150", VA = "0x180D38350")]
		protected void ApplyLimits(OffsetModifier.OffsetLimits[] limits)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060028E4 RID: 10468 RVA: 0x00059EA8 File Offset: 0x000580A8
		[Token(Token = "0x60028E4")]
		[Address(RVA = "0xD38590", Offset = "0xD37390", VA = "0x180D38590", 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: 0x060028E5 RID: 10469 RVA: 0x00059F14 File Offset: 0x00058114
		[Token(Token = "0x60028E5")]
		[Address(RVA = "0xBE5C30", Offset = "0xBE4A30", VA = "0x180BE5C30")]
		protected OffsetModifier()
		{
		}

		// Token: 0x04003223 RID: 12835
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003223")]
		[Tooltip("The master weight")]
		public float weight = 1f;

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

		// Token: 0x04003225 RID: 12837
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003225")]
		protected float lastTime;

		// Token: 0x0200047D RID: 1149
		[Token(Token = "0x200047D")]
		[Serializable]
		public class OffsetLimits
		{
			// Token: 0x060028E6 RID: 10470 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028E6")]
			[Address(RVA = "0x69F500", Offset = "0x69E300", VA = "0x18069F500")]
			public void Apply(IKEffector e, Quaternion rootRotation)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028E7 RID: 10471 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028E7")]
			[Address(RVA = "0x69F6D0", Offset = "0x69E4D0", VA = "0x18069F6D0")]
			private float SpringAxis(float value, float min, float max)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028E8 RID: 10472 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x60028E8")]
			[Address(RVA = "0x69F750", Offset = "0x69E550", VA = "0x18069F750")]
			private float Spring(float value, float limit, bool negative)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x060028E9 RID: 10473 RVA: 0x00059F34 File Offset: 0x00058134
			[Token(Token = "0x60028E9")]
			[Address(RVA = "0x3D8B20", Offset = "0x3D7920", VA = "0x1803D8B20")]
			public OffsetLimits()
			{
			}

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

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

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

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

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

			// Token: 0x0400322B RID: 12843
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x400322B")]
			[Tooltip("The limits")]
			public float minX;

			// Token: 0x0400322C RID: 12844
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x400322C")]
			[Tooltip("The limits")]
			public float maxX;

			// Token: 0x0400322D RID: 12845
			[FieldOffset(Offset = "0x24")]
			[Token(Token = "0x400322D")]
			[Tooltip("The limits")]
			public float minY;

			// Token: 0x0400322E RID: 12846
			[FieldOffset(Offset = "0x28")]
			[Token(Token = "0x400322E")]
			[Tooltip("The limits")]
			public float maxY;

			// Token: 0x0400322F RID: 12847
			[FieldOffset(Offset = "0x2C")]
			[Token(Token = "0x400322F")]
			[Tooltip("The limits")]
			public float minZ;

			// Token: 0x04003230 RID: 12848
			[FieldOffset(Offset = "0x30")]
			[Token(Token = "0x4003230")]
			[Tooltip("The limits")]
			public float maxZ;
		}
	}
}
