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

namespace RootMotion.FinalIK
{
	// Token: 0x020004D7 RID: 1239
	[Token(Token = "0x20004D7")]
	public abstract class OffsetModifierVRIK : MonoBehaviour
	{
		// Token: 0x170002C2 RID: 706
		// (get) Token: 0x06002BB9 RID: 11193 RVA: 0x00061344 File Offset: 0x0005F544
		[Token(Token = "0x170002C2")]
		protected float deltaTime
		{
			[Token(Token = "0x6002BB9")]
			[Address(RVA = "0xE69600", Offset = "0xE68600", VA = "0x180E69600")]
			get
			{
				return Time.time;
			}
		}

		// Token: 0x06002BBA RID: 11194
		[Token(Token = "0x6002BBA")]
		[Address(Slot = "4")]
		protected abstract void OnModifyOffset();

		// Token: 0x06002BBB RID: 11195 RVA: 0x00061358 File Offset: 0x0005F558
		[Token(Token = "0x6002BBB")]
		[Address(RVA = "0xE69580", Offset = "0xE68580", VA = "0x180E69580", 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: 0x06002BBC RID: 11196 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BBC")]
		[Address(RVA = "0xE69310", Offset = "0xE68310", VA = "0x180E69310")]
		private IEnumerator Initiate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BBD RID: 11197 RVA: 0x00061384 File Offset: 0x0005F584
		[Token(Token = "0x6002BBD")]
		[Address(RVA = "0xE69380", Offset = "0xE68380", VA = "0x180E69380")]
		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: 0x06002BBE RID: 11198 RVA: 0x00061404 File Offset: 0x0005F604
		[Token(Token = "0x6002BBE")]
		[Address(RVA = "0xE69460", Offset = "0xE68460", VA = "0x180E69460", 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: 0x06002BBF RID: 11199 RVA: 0x00061470 File Offset: 0x0005F670
		[Token(Token = "0x6002BBF")]
		[Address(RVA = "0x503840", Offset = "0x502840", VA = "0x180503840")]
		protected OffsetModifierVRIK()
		{
		}

		// Token: 0x0400351E RID: 13598
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x400351E")]
		[Tooltip("The master weight")]
		public float weight = 1f;

		// Token: 0x0400351F RID: 13599
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x400351F")]
		[Tooltip("Reference to the VRIK component")]
		public VRIK ik;

		// Token: 0x04003520 RID: 13600
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003520")]
		private float lastTime;
	}
}
