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

namespace RootMotion.FinalIK
{
	// Token: 0x0200047F RID: 1151
	[Token(Token = "0x200047F")]
	public abstract class OffsetModifierVRIK : MonoBehaviour
	{
		// Token: 0x1700029D RID: 669
		// (get) Token: 0x060028F0 RID: 10480 RVA: 0x00059FA0 File Offset: 0x000581A0
		[Token(Token = "0x1700029D")]
		protected float deltaTime
		{
			[Token(Token = "0x60028F0")]
			[Address(RVA = "0xD38330", Offset = "0xD37130", VA = "0x180D38330")]
			get
			{
				return Time.time;
			}
		}

		// Token: 0x060028F1 RID: 10481
		[Token(Token = "0x60028F1")]
		[Address(Slot = "4")]
		protected abstract void OnModifyOffset();

		// Token: 0x060028F2 RID: 10482 RVA: 0x00059FB4 File Offset: 0x000581B4
		[Token(Token = "0x60028F2")]
		[Address(RVA = "0xD382B0", Offset = "0xD370B0", VA = "0x180D382B0", Slot = "5")]
		protected virtual void Start()
		{
			int num;
			OffsetModifierVRIK.<Initiate>d__7 <Initiate>d__ = new OffsetModifierVRIK.<Initiate>d__7(num);
			num = 0;
			<Initiate>d__.<>4__this = this;
			Coroutine coroutine = base.StartCoroutine(<Initiate>d__);
		}

		// Token: 0x060028F3 RID: 10483 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60028F3")]
		[Address(RVA = "0xD38040", Offset = "0xD36E40", VA = "0x180D38040")]
		private IEnumerator Initiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060028F4 RID: 10484 RVA: 0x00059FE0 File Offset: 0x000581E0
		[Token(Token = "0x60028F4")]
		[Address(RVA = "0xD380B0", Offset = "0xD36EB0", VA = "0x180D380B0")]
		private void ModifyOffset()
		{
			if (base.enabled)
			{
				int num = 0;
				if (num < (int)this.weight)
				{
					float time = Time.time;
					if (num < (int)time)
					{
						VRIK vrik = this.ik;
						int num2 = 0;
						if (!(vrik == 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: 0x060028F5 RID: 10485 RVA: 0x0005A060 File Offset: 0x00058260
		[Token(Token = "0x60028F5")]
		[Address(RVA = "0xD38190", Offset = "0xD36F90", VA = "0x180D38190", Slot = "6")]
		protected virtual void OnDestroy()
		{
			VRIK vrik = this.ik;
			int num = 0;
			if (vrik != num)
			{
				IKSolverVR 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: 0x060028F6 RID: 10486 RVA: 0x0005A0CC File Offset: 0x000582CC
		[Token(Token = "0x60028F6")]
		[Address(RVA = "0xBE5C30", Offset = "0xBE4A30", VA = "0x180BE5C30")]
		protected OffsetModifierVRIK()
		{
		}

		// Token: 0x04003234 RID: 12852
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003234")]
		[Tooltip("The master weight")]
		public float weight = 1f;

		// Token: 0x04003235 RID: 12853
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003235")]
		[Tooltip("Reference to the VRIK component")]
		public VRIK ik;

		// Token: 0x04003236 RID: 12854
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003236")]
		private float lastTime;
	}
}
