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

namespace RootMotion.Demos
{
	// Token: 0x020003A7 RID: 935
	[Token(Token = "0x20003A7")]
	public class SimpleAimingSystem : MonoBehaviour
	{
		// Token: 0x060022F9 RID: 8953 RVA: 0x000505AC File Offset: 0x0004E7AC
		[Token(Token = "0x60022F9")]
		[Address(RVA = "0x11F2B20", Offset = "0x11F1920", VA = "0x1811F2B20")]
		private void Start()
		{
			AimIK aimIK = this.aim;
			int num = 0;
			aimIK.enabled = num != 0;
			LookAtIK lookAtIK = this.lookAt;
			int num2 = 0;
			lookAtIK.enabled = num2 != 0;
		}

		// Token: 0x060022FA RID: 8954 RVA: 0x000505E0 File Offset: 0x0004E7E0
		[Token(Token = "0x60022FA")]
		[Address(RVA = "0x11F2560", Offset = "0x11F1360", VA = "0x1811F2560")]
		private void LateUpdate()
		{
			Transform target = this.aim.solver.target;
			int num = 0;
			if (target == num)
			{
				Transform transform = base.transform;
				Debug.LogWarning("AimIK and LookAtIK need to have their 'Target' value assigned.", transform);
			}
			this.Pose();
			this.aim.solver.Update();
			LookAtIK lookAtIK = this.lookAt;
			int num2 = 0;
			if (lookAtIK != num2)
			{
				this.lookAt.solver.Update();
			}
		}

		// Token: 0x060022FB RID: 8955 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60022FB")]
		[Address(RVA = "0x11F28B0", Offset = "0x11F16B0", VA = "0x1811F28B0")]
		private void Pose()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060022FC RID: 8956 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60022FC")]
		[Address(RVA = "0x11F26B0", Offset = "0x11F14B0", VA = "0x1811F26B0")]
		private void LimitAimTarget()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060022FD RID: 8957 RVA: 0x00050660 File Offset: 0x0004E860
		[Token(Token = "0x60022FD")]
		[Address(RVA = "0x11F24D0", Offset = "0x11F12D0", VA = "0x1811F24D0")]
		private void DirectCrossFade(string state, float target)
		{
			float @float = this.animator.GetFloat(state);
			float num = Time.deltaTime;
			num = @float;
			float num2 = Mathf.MoveTowards(num, target, 1f);
			this.animator.SetFloat(state, num2);
		}

		// Token: 0x060022FE RID: 8958 RVA: 0x000506A4 File Offset: 0x0004E8A4
		[Token(Token = "0x60022FE")]
		[Address(RVA = "0x11F2B60", Offset = "0x11F1960", VA = "0x1811F2B60")]
		public SimpleAimingSystem()
		{
		}

		// Token: 0x04002C16 RID: 11286
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4002C16")]
		[Tooltip("AimPoser is a tool that returns an animation name based on direction.")]
		public AimPoser aimPoser;

		// Token: 0x04002C17 RID: 11287
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4002C17")]
		[Tooltip("Reference to the AimIK component.")]
		public AimIK aim;

		// Token: 0x04002C18 RID: 11288
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002C18")]
		[Tooltip("Reference to the LookAt component (only used for the head in this instance).")]
		public LookAtIK lookAt;

		// Token: 0x04002C19 RID: 11289
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4002C19")]
		[Tooltip("Reference to the Animator component.")]
		public Animator animator;

		// Token: 0x04002C1A RID: 11290
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4002C1A")]
		[Tooltip("Time of cross-fading from pose to pose.")]
		public float crossfadeTime = 0.2f;

		// Token: 0x04002C1B RID: 11291
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x4002C1B")]
		[Tooltip("Will keep the aim target at a distance.")]
		public float minAimDistance = 0.5f;

		// Token: 0x04002C1C RID: 11292
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4002C1C")]
		private AimPoser.Pose aimPose;

		// Token: 0x04002C1D RID: 11293
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4002C1D")]
		private AimPoser.Pose lastPose;
	}
}
