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

namespace RootMotion.Demos
{
	// Token: 0x0200041E RID: 1054
	[Token(Token = "0x200041E")]
	public class MotionAbsorb : MonoBehaviour
	{
		// Token: 0x06002638 RID: 9784 RVA: 0x00058478 File Offset: 0x00056678
		[Token(Token = "0x6002638")]
		[Address(RVA = "0xC32E40", Offset = "0xC31E40", VA = "0x180C32E40")]
		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: 0x06002639 RID: 9785 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002639")]
		[Address(RVA = "0xC32DD0", Offset = "0xC31DD0", VA = "0x180C32DD0")]
		private IEnumerator AbsorbMotion()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x0600263A RID: 9786 RVA: 0x000584B4 File Offset: 0x000566B4
		[Token(Token = "0x600263A")]
		[Address(RVA = "0xC32ED0", Offset = "0xC31ED0", VA = "0x180C32ED0")]
		public MotionAbsorb()
		{
		}

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

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

		// Token: 0x04002FDF RID: 12255
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002FDF")]
		[Tooltip("The master weight")]
		public float weight = 1f;

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

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

		// Token: 0x04002FE2 RID: 12258
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x4002FE2")]
		private float timer;

		// Token: 0x0200041F RID: 1055
		[Token(Token = "0x200041F")]
		[Serializable]
		public class Absorber
		{
			// Token: 0x0600263B RID: 9787 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x600263B")]
			[Address(RVA = "0x696B10", Offset = "0x695B10", VA = "0x180696B10")]
			public void SetToBone(IKSolverFullBodyBiped solver)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x0600263C RID: 9788 RVA: 0x000584E0 File Offset: 0x000566E0
			[Token(Token = "0x600263C")]
			[Address(RVA = "0x696AA0", Offset = "0x695AA0", VA = "0x180696AA0")]
			public void SetEffectorWeights(IKSolverFullBodyBiped solver, float w)
			{
				/*
An exception occurred when decompiling this method (0600263C)

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: 0x0600263D RID: 9789 RVA: 0x00058534 File Offset: 0x00056734
			[Token(Token = "0x600263D")]
			[Address(RVA = "0x696BE0", Offset = "0x695BE0", VA = "0x180696BE0")]
			public Absorber()
			{
			}

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

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