using System;
using System.Collections;
using Cpp2IlInjected;
using RootMotion.FinalIK;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020003C6 RID: 966
	[Token(Token = "0x20003C6")]
	public class MotionAbsorb : MonoBehaviour
	{
		// Token: 0x0600236F RID: 9071 RVA: 0x00051220 File Offset: 0x0004F420
		[Token(Token = "0x600236F")]
		[Address(RVA = "0xBC8190", Offset = "0xBC6F90", VA = "0x180BC8190")]
		private void OnCollisionEnter()
		{
			float num = this.timer;
			int num2 = 0;
			if (num <= (float)num2)
			{
				int num3;
				MotionAbsorb.<AbsorbMotion>d__8 <AbsorbMotion>d__ = new MotionAbsorb.<AbsorbMotion>d__8(num3);
				num3 = 0;
				<AbsorbMotion>d__.<>4__this = this;
				Coroutine coroutine = base.StartCoroutine(<AbsorbMotion>d__);
			}
		}

		// Token: 0x06002370 RID: 9072 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002370")]
		[Address(RVA = "0xBC8120", Offset = "0xBC6F20", VA = "0x180BC8120")]
		private IEnumerator AbsorbMotion()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002371 RID: 9073 RVA: 0x0005125C File Offset: 0x0004F45C
		[Token(Token = "0x6002371")]
		[Address(RVA = "0xBC8220", Offset = "0xBC7020", VA = "0x180BC8220")]
		public MotionAbsorb()
		{
		}

		// Token: 0x04002CF3 RID: 11507
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4002CF3")]
		[Tooltip("Reference to the FBBIK component")]
		public FullBodyBipedIK ik;

		// Token: 0x04002CF4 RID: 11508
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4002CF4")]
		[Tooltip("Array containing the absorbers")]
		public MotionAbsorb.Absorber[] absorbers;

		// Token: 0x04002CF5 RID: 11509
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002CF5")]
		[Tooltip("The master weight")]
		public float weight = 1f;

		// Token: 0x04002CF6 RID: 11510
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4002CF6")]
		[Tooltip("Weight falloff curve (how fast will the effect reduce after impact)")]
		public AnimationCurve falloff;

		// Token: 0x04002CF7 RID: 11511
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4002CF7")]
		[Tooltip("How fast will the impact fade away. (if 1, effect lasts for 1 second)")]
		public float falloffSpeed = 1f;

		// Token: 0x04002CF8 RID: 11512
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x4002CF8")]
		private float timer;

		// Token: 0x020003C7 RID: 967
		[Token(Token = "0x20003C7")]
		[Serializable]
		public class Absorber
		{
			// Token: 0x06002372 RID: 9074 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002372")]
			[Address(RVA = "0x69B660", Offset = "0x69A460", VA = "0x18069B660")]
			public void SetToBone(IKSolverFullBodyBiped solver)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002373 RID: 9075 RVA: 0x00051288 File Offset: 0x0004F488
			[Token(Token = "0x6002373")]
			[Address(RVA = "0x69B5F0", Offset = "0x69A3F0", VA = "0x18069B5F0")]
			public void SetEffectorWeights(IKSolverFullBodyBiped solver, float w)
			{
				/*
An exception occurred when decompiling this method (06002373)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void RootMotion.Demos.MotionAbsorb/Absorber::SetEffectorWeights(RootMotion.FinalIK.IKSolverFullBodyBiped,System.Single)

 ---> System.ArgumentOutOfRangeException: Non-negative number required. (Parameter 'length')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length)
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.StackSlot.ModifyStack(StackSlot[] stack, Int32 popCount, Int32 pushCount, ByteCode pushDefinition) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 51
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.StackAnalysis(MethodDef methodDef) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 401
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.Build(MethodDef methodDef, Boolean optimize, DecompilerContext context) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 276
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 112
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
			}

			// Token: 0x06002374 RID: 9076 RVA: 0x000512DC File Offset: 0x0004F4DC
			[Token(Token = "0x6002374")]
			[Address(RVA = "0x5FD950", Offset = "0x5FC750", VA = "0x1805FD950")]
			public Absorber()
			{
			}

			// Token: 0x04002CF9 RID: 11513
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4002CF9")]
			[Tooltip("The type of effector (hand, foot, shoulder...) - this is just an enum")]
			public FullBodyBipedEffector effector;

			// Token: 0x04002CFA RID: 11514
			[FieldOffset(Offset = "0x14")]
			[Token(Token = "0x4002CFA")]
			[Tooltip("How much should motion be absorbed on this effector")]
			public float weight = 1f;
		}
	}
}
