Decompiled source of H3VRPlayerBodySystem v1.0.0

plugins/H3VRPlayerBodySystem.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using H3MP;
using H3MP.Scripts;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RootMotion.FinalIK;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("H3VR_PlayerBody_System")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("H3VR_PlayerBody_System")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("97acd6e1-cb70-435d-af5c-67b73019ad9c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PlayerBodySystem
{
	public class PlayerBodyFootPlacementData : MonoBehaviour
	{
		public enum LimbID
		{
			LEFT_FOOT,
			RIGHT_FOOT,
			LEFT_HAND,
			RIGHT_HAND
		}

		public enum Target
		{
			FOOT,
			TOE,
			HEEL
		}

		[Header("This component contains data used to modify foot placement.")]
		[Header("There should be one for each foot on this game object.")]
		[Header("You can try changing settings if your feet aren't being correctly planted on the ground.")]
		private Animator _playerBodyAnimator;

		public LimbID mFootID;

		public bool mPlantFoot = true;

		public Vector3 mForwardVector = new Vector3(0f, 0f, 1f);

		public Vector3 mIKHintOffset = new Vector3(0f, 0f, 0f);

		public Vector3 mUpVector = new Vector3(0f, 1f, 0f);

		public float mFootOffsetDist = 0.5f;

		public float mFootLength = 0.22f;

		public float mFootHalfWidth = 0.05f;

		public float mFootHeight = 0.1f;

		public float mFootRotationLimit = 45f;

		public float mTransitionTime = 0.2f;

		public float mExtraRayDistanceCheck;

		public bool mSetExtraRaydistanceCheckAutomatically;

		public float mErrorThreshold = 0.05f;

		public float mExtraRayDistanceCheckMin;

		public float mExtraRayDistanceCheckMax = 2f;

		protected bool mFootPlantIsOnTransition;

		protected float mFootPlantBlendSpeed;

		protected Vector3 mTargetPos = new Vector3(0f, 0f, 0f);

		protected Vector3 mTargetToePos = new Vector3(0f, 0f, 0f);

		protected Vector3 mTargetHeelPos = new Vector3(0f, 0f, 0f);

		protected Vector3 mRotatedFwdVec;

		protected Vector3 mRotatedIKHintOffset;

		protected float mTargetFootWeight;

		protected float mCurrentFootWeight;

		protected float mGoalBlendSpeed;

		protected float mPlantBlendFactor;

		private Vector3 mFootPlantedPos;

		private Quaternion mFootPlantedRot;

		private bool mFootPlanted;

		private Vector3 mPreviousFootPos = Vector3.zero;

		public void SetTargetPos(Target target, Vector3 target_pos)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			switch (target)
			{
			case Target.FOOT:
				mTargetPos = target_pos;
				break;
			case Target.TOE:
				mTargetToePos = target_pos;
				break;
			case Target.HEEL:
				mTargetHeelPos = target_pos;
				break;
			}
		}

		public Vector3 GetTargetPos(Target target)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			return (Vector3)(target switch
			{
				Target.FOOT => mTargetPos, 
				Target.TOE => mTargetToePos, 
				Target.HEEL => mTargetHeelPos, 
				_ => Vector3.zero, 
			});
		}

		public void CalculateRotatedFwdVec()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			AvatarIKGoal val = (AvatarIKGoal)0;
			switch (mFootID)
			{
			case LimbID.RIGHT_FOOT:
				val = (AvatarIKGoal)1;
				break;
			case LimbID.LEFT_HAND:
				val = (AvatarIKGoal)2;
				break;
			case LimbID.RIGHT_HAND:
				val = (AvatarIKGoal)3;
				break;
			}
			float num = 0f;
			Quaternion iKRotation = _playerBodyAnimator.GetIKRotation(val);
			num = ((Quaternion)(ref iKRotation)).eulerAngles.y * (float)Math.PI / 180f;
			Quaternion val2 = default(Quaternion);
			((Quaternion)(ref val2))..ctor(0f, Mathf.Sin(num * 0.5f), 0f, Mathf.Cos(num * 0.5f));
			if (mFootPlanted && mPlantFoot)
			{
				num = ((Quaternion)(ref mFootPlantedRot)).eulerAngles.y * (float)Math.PI / 180f;
				val2 = Quaternion.Slerp(val2, new Quaternion(0f, Mathf.Sin(num * 0.5f), 0f, Mathf.Cos(num * 0.5f)), mPlantBlendFactor);
			}
			mRotatedFwdVec = val2 * ((Vector3)(ref mForwardVector)).normalized;
		}

		public Vector3 GetRotatedFwdVec()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return mRotatedFwdVec;
		}

		public void CalculateRotatedIKHint()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = ((Component)this).transform.rotation;
			float num = ((Quaternion)(ref rotation)).eulerAngles.y * (float)Math.PI / 180f;
			Quaternion val = default(Quaternion);
			((Quaternion)(ref val))..ctor(0f, Mathf.Sin(num * 0.5f), 0f, Mathf.Cos(num * 0.5f));
			mRotatedIKHintOffset = val * mIKHintOffset;
		}

		public Vector3 GetRotatedIKHint()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return mRotatedIKHintOffset;
		}

		public void SetTargetFootWeight(float weight)
		{
			mTargetFootWeight = weight;
		}

		public float GetTargetFootWeight()
		{
			return mTargetFootWeight;
		}

		public void SetCurrentFootWeight(float weight)
		{
			mCurrentFootWeight = weight;
		}

		public float GetCurrentFootWeight()
		{
			return mCurrentFootWeight;
		}

		public void SetGoalBlendSpeed(float speed)
		{
			mGoalBlendSpeed = speed;
		}

		public float GetGoalBlendSpeed()
		{
			return mGoalBlendSpeed;
		}

		public float GetPlantBlendFactor()
		{
			return mPlantBlendFactor;
		}

		public void SetPlantBlendFactor(float factor)
		{
			mPlantBlendFactor = factor;
		}

		public void EnablePlantBlend(float blend_speed)
		{
			mFootPlantBlendSpeed = Mathf.Abs(blend_speed);
			mFootPlantIsOnTransition = true;
		}

		public void DisablePlantBlend(float blend_speed)
		{
			mFootPlantBlendSpeed = 0f - Mathf.Abs(blend_speed);
			mFootPlantIsOnTransition = true;
		}

		public float GetFootPlantBlendSpeed()
		{
			return mFootPlantBlendSpeed;
		}

		public void PlantBlendTransitionEnded()
		{
			mFootPlantIsOnTransition = false;
		}

		public bool IsPlantOnTransition()
		{
			return mFootPlantIsOnTransition;
		}

		public void SetFootPlanted(bool planted)
		{
			mFootPlanted = planted;
		}

		public bool GetFootPlanted()
		{
			return mFootPlanted;
		}

		public void SetPlantedPos(Vector3 planted_pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			mFootPlantedPos = planted_pos;
		}

		public Vector3 GetPlantedPos()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return mFootPlantedPos;
		}

		public void SetPlantedRot(Quaternion planted_rot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			mFootPlantedRot = planted_rot;
		}

		public Quaternion GetPlantedRot()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return mFootPlantedRot;
		}

		public void Start()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			_playerBodyAnimator = ((Component)this).GetComponent<Animator>();
			if (!((Object)(object)_playerBodyAnimator == (Object)null))
			{
				HumanBodyBones val = (HumanBodyBones)5;
				switch (mFootID)
				{
				case LimbID.RIGHT_FOOT:
					val = (HumanBodyBones)6;
					break;
				case LimbID.RIGHT_HAND:
					val = (HumanBodyBones)18;
					break;
				case LimbID.LEFT_HAND:
					val = (HumanBodyBones)17;
					break;
				}
				mPreviousFootPos = _playerBodyAnimator.GetBoneTransform(val).position;
			}
		}

		protected bool IsErrorHigh(HumanBodyBones bone, Vector3 current_position, Vector3 previous_pos)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = previous_pos - current_position;
			float magnitude = ((Vector3)(ref val)).magnitude;
			float num = mErrorThreshold;
			if (Time.deltaTime < 0.033f)
			{
				num = mErrorThreshold * 30f * Time.deltaTime;
			}
			if (magnitude > num)
			{
				return true;
			}
			return false;
		}

		private void OnAnimatorIK()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			if (mSetExtraRaydistanceCheckAutomatically && !((Object)(object)_playerBodyAnimator == (Object)null))
			{
				HumanBodyBones val = (HumanBodyBones)5;
				switch (mFootID)
				{
				case LimbID.RIGHT_FOOT:
					val = (HumanBodyBones)6;
					break;
				case LimbID.RIGHT_HAND:
					val = (HumanBodyBones)18;
					break;
				case LimbID.LEFT_HAND:
					val = (HumanBodyBones)17;
					break;
				}
				if (IsErrorHigh(val, _playerBodyAnimator.GetBoneTransform(val).position, mPreviousFootPos))
				{
					mExtraRayDistanceCheck = mExtraRayDistanceCheckMin;
				}
				else
				{
					mExtraRayDistanceCheck = mExtraRayDistanceCheckMax;
				}
				mPreviousFootPos = _playerBodyAnimator.GetBoneTransform(val).position;
			}
		}
	}
	[BepInPlugin("h3vr.cityrobo.H3VRPlayerBodySystem", "H3VR PlayerBody System", "1.0.0")]
	public class H3VRPlayerBodySystem_BepInEx : BaseUnityPlugin
	{
		public void Awake()
		{
			Harmony.CreateAndPatchAll(typeof(PlayerBodyFaceController), (string)null);
		}
	}
	public class PlayerBodyFaceController : MonoBehaviour
	{
		public Animator PlayerBodyAnimator;

		[Header("Blink Animation System")]
		public string BlinkAnimationTriggerPropertyName = "Blink";

		[Tooltip("Found these values online for the average time between blinks.\nFeel free to change them.")]
		public Vector2 RandomBlinkIntervalRange = new Vector2(2f, 6f);

		[Header("Pain Animation System")]
		public string PainAnimationTriggerPropertyName = "Pain";

		public void Start()
		{
			((MonoBehaviour)this).StartCoroutine(WaitForBlink());
		}

		private IEnumerator WaitForBlink()
		{
			while (true)
			{
				float num = Random.Range(RandomBlinkIntervalRange.x, RandomBlinkIntervalRange.y);
				yield return (object)new WaitForSeconds(num);
				PlayerBodyAnimator.SetTrigger(BlinkAnimationTriggerPropertyName);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(FVRPlayerBody), "RegisterPlayerHit")]
		public void FVRPlayerBodyRegisterPlayerHitPatch()
		{
			PlayerBodyAnimator.SetTrigger(PainAnimationTriggerPropertyName);
		}
	}
	public class PlayerBodyLegsController : MonoBehaviour
	{
		[Header("This component controls the leg movement animation.")]
		[Header("Has some tooltips for your pleasure.")]
		[Tooltip("Speed at which the animation starts playing.")]
		public float AnimationActivationSpeedTreshold = 0.7f;

		[Tooltip("Animation Smoothing between different speed values.")]
		[Range(0f, 1f)]
		public float AnimationSmoothing = 0.2f;

		[Tooltip("Animator on the PlayerBody rig.")]
		public Animator PlayerBodyAnimator;

		[Header("Animation transition names:")]
		public string IsMovingAnimationStateName = "IsMoving";

		public string LeftRightAnimationFloatName = "D_X";

		public string ForwardBackAnimationFloatName = "D_Y";

		private Vector3 _lastPos;

		private float _lastD_X;

		private float _lastD_Y;

		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			_lastPos = ((Component)this).transform.position;
		}

		public void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (((Component)this).transform.position - _lastPos) / Time.deltaTime;
			val.y = 0f;
			Vector3 val2 = ((Component)this).transform.InverseTransformDirection(val);
			_lastD_X = Mathf.Lerp(_lastD_X, Mathf.Clamp(val2.x, -1f, 1f), AnimationSmoothing);
			_lastD_Y = Mathf.Lerp(_lastD_Y, Mathf.Clamp(val2.z, -1f, 1f), AnimationSmoothing);
			bool flag = ((Vector3)(ref val2)).magnitude > AnimationActivationSpeedTreshold;
			PlayerBodyAnimator.SetBool(IsMovingAnimationStateName, flag);
			PlayerBodyAnimator.SetFloat(LeftRightAnimationFloatName, _lastD_X);
			PlayerBodyAnimator.SetFloat(ForwardBackAnimationFloatName, _lastD_Y);
			_lastPos = ((Component)this).transform.position;
		}
	}
	public class PlayerBodyFootPlacer : MonoBehaviour
	{
		[Header("This component provides the foot placement functionality.")]
		[Header("It tries to keep the feet touching the ground.")]
		[Header("You can try changing settings if your feet aren't being correctly planted on the ground.")]
		private Animator _playerBodyAnimator;

		public bool mAdjustPelvisVertically;

		public bool mDampPelvis;

		public float mMaxLegLength = 1f;

		public float mMinLegLength = 0.2f;

		public float mPelvisAdjustmentSpeed = 1f;

		public string[] mLayersToIgnore;

		protected PlayerBodyFootPlacementData mLeftFoot;

		protected PlayerBodyFootPlacementData mRightFoot;

		protected PlayerBodyFootPlacementData mLeftHand;

		protected PlayerBodyFootPlacementData mRightHand;

		protected LayerMask mLayerMask = LayerMask.op_Implicit(-1);

		private const float mEpsilon = 0.005f;

		private float mCurrentRootVertError;

		private float mTargetRootVertError;

		private float mCurrentPelvisSpeed;

		private Vector3 mLeftFootContact_Ontransition_Disable;

		private Vector3 mLeftToeContact_Ontransition_Disable;

		private Vector3 mLeftHeelContact_Ontransition_Disable;

		private Vector3 mRightFootContact_Ontransition_Disable;

		private Vector3 mRightToeContact_Ontransition_Disable;

		private Vector3 mRightHeelContact_Ontransition_Disable;

		private Vector3 mLeftHandContact_Ontransition_Disable;

		private Vector3 mLeftHandToeContact_Ontransition_Disable;

		private Vector3 mLeftHandHeelContact_Ontransition_Disable;

		private Vector3 mRightHandContact_Ontransition_Disable;

		private Vector3 mRightHandToeContact_Ontransition_Disable;

		private Vector3 mRightHandHeelContact_Ontransition_Disable;

		private bool mRootPosLeftRightFoot;

		private bool mLeftFootActive = true;

		private bool mRightFootActive = true;

		private bool mLeftHandActive = true;

		private bool mRightHandActive = true;

		public void SetActive(AvatarIKGoal foot_id, bool active)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if ((int)foot_id == 0)
			{
				if ((Object)(object)mLeftFoot == (Object)null)
				{
					return;
				}
				if (active && !mLeftFootActive)
				{
					ResetIKParams(foot_id);
				}
				mLeftFootActive = active;
			}
			if ((int)foot_id == 1)
			{
				if ((Object)(object)mRightFoot == (Object)null)
				{
					return;
				}
				if (active && !mRightFootActive)
				{
					ResetIKParams(foot_id);
				}
				mRightFootActive = active;
			}
			if ((int)foot_id == 2)
			{
				if ((Object)(object)mRightHand == (Object)null)
				{
					return;
				}
				if (active && !mLeftHandActive)
				{
					ResetIKParams(foot_id);
				}
				mLeftHandActive = active;
			}
			if ((int)foot_id == 3 && !((Object)(object)mRightHand == (Object)null))
			{
				if (active && !mRightHandActive)
				{
					ResetIKParams(foot_id);
				}
				mRightHandActive = active;
			}
		}

		public bool IsActive(AvatarIKGoal foot_id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			if ((int)foot_id == 0)
			{
				return mLeftFootActive;
			}
			if ((int)foot_id == 1)
			{
				return mRightFootActive;
			}
			if ((int)foot_id == 2)
			{
				return mLeftHandActive;
			}
			if ((int)foot_id == 3)
			{
				return mRightHandActive;
			}
			return false;
		}

		public void SetLayerMask(LayerMask layer_mask)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			mLayerMask = layer_mask;
		}

		public LayerMask GetLayerMask()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return mLayerMask;
		}

		public float GetPlantBlendWeight(AvatarIKGoal foot_id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			default:
				return -1f;
			}
			return playerBodyFootPlacementData.GetPlantBlendFactor();
		}

		public void SetPlantBlendWeight(AvatarIKGoal foot_id, float weight)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			playerBodyFootPlacementData.SetPlantBlendFactor(weight);
		}

		public void EnablePlant(AvatarIKGoal foot_id, float blend_speed)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			playerBodyFootPlacementData.EnablePlantBlend(blend_speed);
		}

		public void DisablePlant(AvatarIKGoal foot_id, float blend_speed)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			playerBodyFootPlacementData.DisablePlantBlend(blend_speed);
		}

		private void ResetIKParams(AvatarIKGoal foot_id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Invalid comparison between Unknown and I4
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Invalid comparison between Unknown and I4
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			if ((int)foot_id == 0)
			{
				Vector3 position = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)5).position;
				mLeftFoot.SetTargetFootWeight(0f);
				mLeftFoot.SetCurrentFootWeight(0f);
				mLeftFoot.SetGoalBlendSpeed(0f);
				mLeftFoot.SetFootPlanted(planted: false);
				mLeftFootContact_Ontransition_Disable = position;
				mLeftToeContact_Ontransition_Disable = mLeftFoot.mUpVector * mLeftFoot.mFootOffsetDist + mLeftFoot.GetRotatedFwdVec() * mLeftFoot.mFootLength;
				mLeftHeelContact_Ontransition_Disable = position + new Quaternion(0f, 0.7071f, 0f, 0.7071f) * mLeftFoot.GetRotatedFwdVec() * mLeftFoot.mFootHalfWidth;
			}
			if ((int)foot_id == 1)
			{
				Vector3 position2 = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)6).position;
				mRightFoot.SetTargetFootWeight(0f);
				mRightFoot.SetCurrentFootWeight(0f);
				mRightFoot.SetGoalBlendSpeed(0f);
				mRightFoot.SetFootPlanted(planted: false);
				mRightFootContact_Ontransition_Disable = position2;
				mRightToeContact_Ontransition_Disable = mRightFoot.mUpVector * mRightFoot.mFootOffsetDist + mRightFoot.GetRotatedFwdVec() * mRightFoot.mFootLength;
				mRightHeelContact_Ontransition_Disable = position2 + new Quaternion(0f, 0.7017f, 0f, 0.7071f) * mRightFoot.GetRotatedFwdVec() * mRightFoot.mFootHalfWidth;
			}
			if ((int)foot_id == 2)
			{
				Vector3 position3 = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)17).position;
				mLeftHand.SetTargetFootWeight(0f);
				mLeftHand.SetCurrentFootWeight(0f);
				mLeftHand.SetGoalBlendSpeed(0f);
				mLeftHand.SetFootPlanted(planted: false);
				mLeftHandContact_Ontransition_Disable = position3;
				mLeftHandToeContact_Ontransition_Disable = mLeftHand.mUpVector * mLeftHand.mFootOffsetDist + mLeftHand.GetRotatedFwdVec() * mLeftHand.mFootLength;
				mLeftHandHeelContact_Ontransition_Disable = position3 + new Quaternion(0f, 0.7017f, 0f, 0.7071f) * mLeftHand.GetRotatedFwdVec() * mLeftHand.mFootHalfWidth;
			}
			if ((int)foot_id == 3)
			{
				Vector3 position4 = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)18).position;
				mRightHand.SetTargetFootWeight(0f);
				mRightHand.SetCurrentFootWeight(0f);
				mRightHand.SetGoalBlendSpeed(0f);
				mRightHand.SetFootPlanted(planted: false);
				mRightHandContact_Ontransition_Disable = position4;
				mRightHandToeContact_Ontransition_Disable = mRightHand.mUpVector * mRightHand.mFootOffsetDist + mRightHand.GetRotatedFwdVec() * mRightHand.mFootLength;
				mRightHandHeelContact_Ontransition_Disable = position4 + new Quaternion(0f, 0.7017f, 0f, 0.7071f) * mRightHand.GetRotatedFwdVec() * mRightHand.mFootHalfWidth;
			}
		}

		protected void SetIKWeight(AvatarIKGoal foot_id, float target_weight, float transition_time)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			switch ((int)foot_id)
			{
			case 0:
				if (Mathf.Abs(target_weight - mLeftFoot.GetTargetFootWeight()) > 0.005f)
				{
					if (transition_time != 0f)
					{
						mLeftFoot.SetGoalBlendSpeed((target_weight - mLeftFoot.GetCurrentFootWeight()) / transition_time);
					}
					else
					{
						mLeftFoot.SetGoalBlendSpeed(0.1f);
						mLeftFoot.SetCurrentFootWeight(target_weight);
					}
				}
				mLeftFoot.SetTargetFootWeight(target_weight);
				break;
			case 1:
				if (Mathf.Abs(target_weight - mRightFoot.GetTargetFootWeight()) > 0.005f)
				{
					if (transition_time != 0f)
					{
						mRightFoot.SetGoalBlendSpeed((target_weight - mRightFoot.GetCurrentFootWeight()) / transition_time);
					}
					else
					{
						mRightFoot.SetGoalBlendSpeed(0.1f);
						mRightFoot.SetCurrentFootWeight(target_weight);
					}
				}
				mRightFoot.SetTargetFootWeight(target_weight);
				break;
			case 2:
				if (Mathf.Abs(target_weight - mLeftHand.GetTargetFootWeight()) > 0.005f)
				{
					if (transition_time != 0f)
					{
						mLeftHand.SetGoalBlendSpeed((target_weight - mLeftHand.GetCurrentFootWeight()) / transition_time);
					}
					else
					{
						mLeftHand.SetGoalBlendSpeed(0.1f);
						mLeftHand.SetCurrentFootWeight(target_weight);
					}
				}
				mLeftHand.SetTargetFootWeight(target_weight);
				break;
			case 3:
				if (Mathf.Abs(target_weight - mRightHand.GetTargetFootWeight()) > 0.005f)
				{
					if (transition_time != 0f)
					{
						mRightHand.SetGoalBlendSpeed((target_weight - mRightHand.GetCurrentFootWeight()) / transition_time);
					}
					else
					{
						mRightHand.SetGoalBlendSpeed(0.1f);
						mRightHand.SetCurrentFootWeight(target_weight);
					}
				}
				mRightHand.SetTargetFootWeight(target_weight);
				break;
			}
		}

		protected void CalculateIKGoalWeights(AvatarIKGoal foot_id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			float num = Mathf.Sign(playerBodyFootPlacementData.GetTargetFootWeight() - playerBodyFootPlacementData.GetCurrentFootWeight());
			playerBodyFootPlacementData.SetCurrentFootWeight(playerBodyFootPlacementData.GetCurrentFootWeight() + playerBodyFootPlacementData.GetGoalBlendSpeed() * Time.deltaTime);
			if (num * Mathf.Sign(playerBodyFootPlacementData.GetTargetFootWeight() - playerBodyFootPlacementData.GetCurrentFootWeight()) < 1f || Mathf.Abs(playerBodyFootPlacementData.GetCurrentFootWeight() - playerBodyFootPlacementData.GetTargetFootWeight()) < 0.005f)
			{
				playerBodyFootPlacementData.SetCurrentFootWeight(playerBodyFootPlacementData.GetTargetFootWeight());
			}
			else if (playerBodyFootPlacementData.GetCurrentFootWeight() > 1f || playerBodyFootPlacementData.GetCurrentFootWeight() < 0f)
			{
				playerBodyFootPlacementData.SetCurrentFootWeight(Mathf.Clamp(playerBodyFootPlacementData.GetTargetFootWeight(), 0f, 1f));
			}
		}

		protected void CheckForLimits(AvatarIKGoal foot_id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			Vector3 zero = Vector3.zero;
			Vector3 rotatedFwdVec = playerBodyFootPlacementData.GetRotatedFwdVec();
			if (Vector3.Angle(rotatedFwdVec, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE)) > playerBodyFootPlacementData.mFootRotationLimit)
			{
				zero = playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootLength * Mathf.Tan(playerBodyFootPlacementData.mFootRotationLimit * ((float)Math.PI / 180f));
				if (Vector3.Angle(playerBodyFootPlacementData.mUpVector, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE)) > 90f)
				{
					zero = -zero;
				}
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.TOE, rotatedFwdVec * playerBodyFootPlacementData.mFootLength + zero);
			}
			Quaternion val = default(Quaternion);
			((Quaternion)(ref val))..ctor(0f, 0.7071f, 0f, 0.7071f);
			if (Vector3.Angle(val * rotatedFwdVec, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL)) > playerBodyFootPlacementData.mFootRotationLimit)
			{
				zero = playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootHalfWidth * Mathf.Tan(playerBodyFootPlacementData.mFootRotationLimit * ((float)Math.PI / 180f));
				if (Vector3.Angle(playerBodyFootPlacementData.mUpVector, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL)) > 90f)
				{
					zero = -zero;
				}
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.HEEL, val * rotatedFwdVec * playerBodyFootPlacementData.mFootHalfWidth + zero);
			}
		}

		protected void UpdateFootPlantBlendWeights(AvatarIKGoal foot_id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			if (!playerBodyFootPlacementData.IsPlantOnTransition())
			{
				return;
			}
			playerBodyFootPlacementData.SetPlantBlendFactor(playerBodyFootPlacementData.GetPlantBlendFactor() + playerBodyFootPlacementData.GetFootPlantBlendSpeed() * Time.deltaTime);
			if (playerBodyFootPlacementData.GetFootPlantBlendSpeed() > 0f)
			{
				if (playerBodyFootPlacementData.GetPlantBlendFactor() > 1f)
				{
					playerBodyFootPlacementData.SetPlantBlendFactor(1f);
					playerBodyFootPlacementData.PlantBlendTransitionEnded();
				}
			}
			else if (playerBodyFootPlacementData.GetPlantBlendFactor() < 0f)
			{
				playerBodyFootPlacementData.SetPlantBlendFactor(0f);
				playerBodyFootPlacementData.PlantBlendTransitionEnded();
			}
		}

		protected void FindContactPoints(AvatarIKGoal foot_id)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected I4, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected I4, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected I4, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Expected I4, but got Unknown
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected I4, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Expected I4, but got Unknown
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Expected I4, but got Unknown
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			Vector3 iKPosition = _playerBodyAnimator.GetIKPosition(foot_id);
			bool flag = true;
			PlayerBodyFootPlacementData playerBodyFootPlacementData;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(iKPosition + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootOffsetDist, -playerBodyFootPlacementData.mUpVector, ref val, playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.mFootHeight + playerBodyFootPlacementData.mExtraRayDistanceCheck, LayerMask.op_Implicit(mLayerMask)))
			{
				SetIKWeight(foot_id, 1f, playerBodyFootPlacementData.mTransitionTime);
				Vector3 val2 = ((RaycastHit)(ref val)).point;
				if (playerBodyFootPlacementData.mPlantFoot && playerBodyFootPlacementData.GetFootPlanted() && Physics.Raycast(playerBodyFootPlacementData.GetPlantedPos() + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootOffsetDist, -playerBodyFootPlacementData.mUpVector, ref val, playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.mFootHeight + playerBodyFootPlacementData.mExtraRayDistanceCheck, LayerMask.op_Implicit(mLayerMask)))
				{
					val2 = Vector3.Lerp(val2, ((RaycastHit)(ref val)).point, playerBodyFootPlacementData.GetPlantBlendFactor());
				}
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.FOOT, val2);
				switch ((int)foot_id)
				{
				case 0:
					mLeftFootContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT);
					break;
				case 1:
					mRightFootContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT);
					break;
				case 2:
					mLeftHandContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT);
					break;
				case 3:
					mRightHandContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT);
					break;
				}
				flag = true;
			}
			else
			{
				SetIKWeight(foot_id, 0f, playerBodyFootPlacementData.mTransitionTime);
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.FOOT, Vector3.Lerp(iKPosition, (Vector3)((int)foot_id switch
				{
					0 => mLeftFootContact_Ontransition_Disable, 
					1 => mRightFootContact_Ontransition_Disable, 
					2 => mLeftHandContact_Ontransition_Disable, 
					3 => mRightHandContact_Ontransition_Disable, 
					_ => Vector3.zero, 
				}), playerBodyFootPlacementData.GetCurrentFootWeight()));
				flag = false;
			}
			if (Physics.Raycast(iKPosition + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.GetRotatedFwdVec() * playerBodyFootPlacementData.mFootLength, -playerBodyFootPlacementData.mUpVector, ref val, playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.mFootLength + playerBodyFootPlacementData.mExtraRayDistanceCheck, LayerMask.op_Implicit(mLayerMask)) && flag)
			{
				Vector3 val3 = ((RaycastHit)(ref val)).point;
				if (playerBodyFootPlacementData.mPlantFoot && playerBodyFootPlacementData.GetFootPlanted() && Physics.Raycast(playerBodyFootPlacementData.GetPlantedPos() + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.GetRotatedFwdVec() * playerBodyFootPlacementData.mFootLength, -playerBodyFootPlacementData.mUpVector, ref val, playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.mFootLength + playerBodyFootPlacementData.mExtraRayDistanceCheck, LayerMask.op_Implicit(mLayerMask)))
				{
					val3 = Vector3.Lerp(val3, ((RaycastHit)(ref val)).point, playerBodyFootPlacementData.GetPlantBlendFactor());
				}
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.TOE, val3 - playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT));
				switch ((int)foot_id)
				{
				case 0:
					mLeftToeContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE);
					break;
				case 1:
					mRightToeContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE);
					break;
				case 2:
					mLeftHandToeContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE);
					break;
				case 3:
					mRightHandToeContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE);
					break;
				}
			}
			else
			{
				Vector3 val4 = (Vector3)((int)foot_id switch
				{
					0 => mLeftToeContact_Ontransition_Disable, 
					1 => mRightToeContact_Ontransition_Disable, 
					2 => mLeftHandToeContact_Ontransition_Disable, 
					3 => mRightHandToeContact_Ontransition_Disable, 
					_ => Vector3.zero, 
				});
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.TOE, Vector3.Slerp(playerBodyFootPlacementData.GetRotatedFwdVec() * playerBodyFootPlacementData.mFootLength, val4, playerBodyFootPlacementData.GetCurrentFootWeight()));
			}
			Quaternion val5 = default(Quaternion);
			((Quaternion)(ref val5))..ctor(0f, 0.7071f, 0f, 0.7071f);
			Vector3 val6 = iKPosition + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootOffsetDist;
			Vector3 val7 = val5 * playerBodyFootPlacementData.GetRotatedFwdVec();
			if (Physics.Raycast(val6 + ((Vector3)(ref val7)).normalized * playerBodyFootPlacementData.mFootHalfWidth, -playerBodyFootPlacementData.mUpVector, ref val, playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.mFootLength + playerBodyFootPlacementData.mExtraRayDistanceCheck, LayerMask.op_Implicit(mLayerMask)) && flag)
			{
				Vector3 val8 = ((RaycastHit)(ref val)).point;
				if (playerBodyFootPlacementData.mPlantFoot && playerBodyFootPlacementData.GetFootPlanted())
				{
					Vector3 val9 = playerBodyFootPlacementData.GetPlantedPos() + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootOffsetDist;
					val7 = val5 * playerBodyFootPlacementData.GetRotatedFwdVec();
					if (Physics.Raycast(val9 + ((Vector3)(ref val7)).normalized * playerBodyFootPlacementData.mFootHalfWidth, -playerBodyFootPlacementData.mUpVector, ref val, playerBodyFootPlacementData.mFootOffsetDist + playerBodyFootPlacementData.mFootLength + playerBodyFootPlacementData.mExtraRayDistanceCheck, LayerMask.op_Implicit(mLayerMask)))
					{
						val8 = Vector3.Lerp(val8, ((RaycastHit)(ref val)).point, playerBodyFootPlacementData.GetPlantBlendFactor());
					}
				}
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.HEEL, val8 - playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT));
				switch ((int)foot_id)
				{
				case 0:
					mLeftHeelContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL);
					break;
				case 1:
					mRightHeelContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL);
					break;
				case 2:
					mLeftHandHeelContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL);
					break;
				case 3:
					mRightHeelContact_Ontransition_Disable = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL);
					break;
				default:
				{
					Vector3 val4 = Vector3.zero;
					break;
				}
				}
			}
			else
			{
				Vector3 val4 = (Vector3)((int)foot_id switch
				{
					0 => mLeftHeelContact_Ontransition_Disable, 
					1 => mRightHeelContact_Ontransition_Disable, 
					2 => mLeftHandHeelContact_Ontransition_Disable, 
					3 => mRightHandHeelContact_Ontransition_Disable, 
					_ => Vector3.zero, 
				});
				playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.HEEL, Vector3.Slerp(val5 * playerBodyFootPlacementData.GetRotatedFwdVec() * playerBodyFootPlacementData.mFootHalfWidth, val4, playerBodyFootPlacementData.GetCurrentFootWeight()));
			}
		}

		protected void RootPositioningCheck()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			AnimateRootVertError();
			if (mAdjustPelvisVertically)
			{
				Vector3 val = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)2).position - _playerBodyAnimator.GetIKPosition((AvatarIKGoal)1);
				float magnitude = ((Vector3)(ref val)).magnitude;
				PlayerBodyFootPlacementData playerBodyFootPlacementData = mRightFoot;
				mRootPosLeftRightFoot = true;
				val = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)1).position - _playerBodyAnimator.GetIKPosition((AvatarIKGoal)0);
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				val = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)2).position - _playerBodyAnimator.GetIKPosition((AvatarIKGoal)1);
				if (sqrMagnitude > ((Vector3)(ref val)).sqrMagnitude)
				{
					val = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)1).position - _playerBodyAnimator.GetIKPosition((AvatarIKGoal)0);
					magnitude = ((Vector3)(ref val)).magnitude;
					playerBodyFootPlacementData = mLeftFoot;
					mRootPosLeftRightFoot = false;
				}
				if (magnitude > mMaxLegLength)
				{
					mTargetRootVertError = magnitude - mMaxLegLength;
					float num = 0f;
					float num2 = 0f;
					val = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)1).position - (_playerBodyAnimator.GetIKPosition((AvatarIKGoal)0) + mLeftFoot.mUpVector * mTargetRootVertError);
					float magnitude2 = ((Vector3)(ref val)).magnitude;
					if (magnitude2 < mMinLegLength)
					{
						num = mMinLegLength - magnitude2;
					}
					val = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)2).position - (_playerBodyAnimator.GetIKPosition((AvatarIKGoal)1) + mLeftFoot.mUpVector * mTargetRootVertError);
					magnitude2 = ((Vector3)(ref val)).magnitude;
					if (magnitude2 < mMinLegLength)
					{
						num2 = mMinLegLength - magnitude2;
					}
					if (num2 != 0f || num != 0f)
					{
						if (num2 > num)
						{
							mTargetRootVertError -= num2;
						}
						else
						{
							mTargetRootVertError -= num;
						}
					}
				}
				else
				{
					mTargetRootVertError = 0f;
					mCurrentPelvisSpeed = 0f;
				}
				_playerBodyAnimator.SetIKPosition((AvatarIKGoal)0, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)0) + playerBodyFootPlacementData.mUpVector * mCurrentRootVertError);
				_playerBodyAnimator.SetIKPosition((AvatarIKGoal)1, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)1) + playerBodyFootPlacementData.mUpVector * mCurrentRootVertError);
				_playerBodyAnimator.SetIKPosition((AvatarIKGoal)2, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)2) + playerBodyFootPlacementData.mUpVector * mCurrentRootVertError);
				_playerBodyAnimator.SetIKPosition((AvatarIKGoal)3, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)3) + playerBodyFootPlacementData.mUpVector * mCurrentRootVertError);
				return;
			}
			mTargetRootVertError = 0f;
			mCurrentPelvisSpeed = 0f;
			if (Mathf.Abs(mCurrentRootVertError) >= 0.005f)
			{
				if (mRootPosLeftRightFoot)
				{
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)0, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)0) + mRightFoot.mUpVector * mCurrentRootVertError);
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)1, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)1) + mRightFoot.mUpVector * mCurrentRootVertError);
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)2, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)2) + mRightFoot.mUpVector * mCurrentRootVertError);
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)3, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)3) + mRightFoot.mUpVector * mCurrentRootVertError);
				}
				else
				{
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)0, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)0) + mRightFoot.mUpVector * mCurrentRootVertError);
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)1, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)1) + mRightFoot.mUpVector * mCurrentRootVertError);
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)2, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)2) + mRightFoot.mUpVector * mCurrentRootVertError);
					_playerBodyAnimator.SetIKPosition((AvatarIKGoal)3, _playerBodyAnimator.GetIKPosition((AvatarIKGoal)3) + mRightFoot.mUpVector * mCurrentRootVertError);
				}
			}
		}

		protected void AnimateRootVertError()
		{
			float num = Mathf.Abs(mCurrentRootVertError - mTargetRootVertError);
			if (num < 0.005f)
			{
				mCurrentRootVertError = mTargetRootVertError;
				mCurrentPelvisSpeed = 0f;
				return;
			}
			float num2 = Mathf.Sign(mTargetRootVertError - mCurrentRootVertError);
			if (mDampPelvis)
			{
				if (num < mTargetRootVertError * 0.3f)
				{
					mCurrentPelvisSpeed -= mPelvisAdjustmentSpeed * Time.deltaTime;
					if (mCurrentPelvisSpeed < mPelvisAdjustmentSpeed * 0.5f)
					{
						mCurrentPelvisSpeed = mPelvisAdjustmentSpeed * 0.5f;
					}
					mCurrentRootVertError += num2 * mCurrentPelvisSpeed * Time.deltaTime;
				}
				else
				{
					mCurrentRootVertError += num2 * mPelvisAdjustmentSpeed * Time.deltaTime;
				}
			}
			else
			{
				mCurrentRootVertError += num2 * mPelvisAdjustmentSpeed * Time.deltaTime;
				mCurrentPelvisSpeed = 0f;
			}
			if (Mathf.Sign(mTargetRootVertError - mCurrentRootVertError) * num2 <= 0f)
			{
				mCurrentRootVertError = mTargetRootVertError;
			}
		}

		public void FootPlacement(AvatarIKGoal foot_id)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected I4, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Invalid comparison between Unknown and I4
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			PlayerBodyFootPlacementData playerBodyFootPlacementData = null;
			switch ((int)foot_id)
			{
			default:
				return;
			case 0:
				if (!mLeftFootActive)
				{
					return;
				}
				playerBodyFootPlacementData = mLeftFoot;
				break;
			case 1:
				if (!mRightFootActive)
				{
					return;
				}
				playerBodyFootPlacementData = mRightFoot;
				break;
			case 2:
				if (!mLeftHandActive)
				{
					return;
				}
				playerBodyFootPlacementData = mLeftHand;
				break;
			case 3:
				if (!mRightHandActive)
				{
					return;
				}
				playerBodyFootPlacementData = mRightHand;
				break;
			}
			((Vector3)(ref playerBodyFootPlacementData.mUpVector)).Normalize();
			((Vector3)(ref playerBodyFootPlacementData.mForwardVector)).Normalize();
			playerBodyFootPlacementData.CalculateRotatedIKHint();
			playerBodyFootPlacementData.CalculateRotatedFwdVec();
			playerBodyFootPlacementData.SetTargetPos(PlayerBodyFootPlacementData.Target.FOOT, _playerBodyAnimator.GetIKPosition(foot_id));
			UpdateFootPlantBlendWeights(foot_id);
			FindContactPoints(foot_id);
			CheckForLimits(foot_id);
			CalculateIKGoalWeights(foot_id);
			_playerBodyAnimator.SetIKRotationWeight(foot_id, playerBodyFootPlacementData.GetCurrentFootWeight());
			float num = Vector3.Angle(playerBodyFootPlacementData.GetRotatedFwdVec(), playerBodyFootPlacementData.mForwardVector);
			Quaternion val = default(Quaternion);
			((Quaternion)(ref val))..ctor(0f, 0.7071f, 0f, 0.7071f);
			Quaternion val2 = Quaternion.FromToRotation(playerBodyFootPlacementData.mForwardVector, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE));
			Vector3 eulerAngles = ((Quaternion)(ref val2)).eulerAngles;
			eulerAngles.z = 0f;
			Quaternion val3 = Quaternion.Euler(eulerAngles);
			if ((num > 90f && num < 180f) || (num > 270f && num < 360f))
			{
				val2 = Quaternion.FromToRotation(playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL), val * playerBodyFootPlacementData.GetRotatedFwdVec());
				eulerAngles = ((Quaternion)(ref val2)).eulerAngles;
			}
			else
			{
				val2 = Quaternion.FromToRotation(val * playerBodyFootPlacementData.GetRotatedFwdVec(), playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.HEEL));
				eulerAngles = ((Quaternion)(ref val2)).eulerAngles;
			}
			eulerAngles.x = 0f;
			eulerAngles.y = 0f;
			val3 *= Quaternion.Euler(eulerAngles);
			_playerBodyAnimator.SetIKRotation(foot_id, val3);
			Vector3 zero = Vector3.zero;
			if ((int)foot_id == 0)
			{
				zero = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)3).position - _playerBodyAnimator.GetIKPosition((AvatarIKGoal)0);
				_playerBodyAnimator.SetIKHintPositionWeight((AvatarIKHint)0, playerBodyFootPlacementData.GetCurrentFootWeight());
				_playerBodyAnimator.SetIKHintPosition((AvatarIKHint)0, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE) + playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT) + playerBodyFootPlacementData.GetRotatedIKHint() + zero);
			}
			if ((int)foot_id == 1)
			{
				zero = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)4).position - _playerBodyAnimator.GetBoneTransform((HumanBodyBones)6).position;
				_playerBodyAnimator.SetIKHintPositionWeight((AvatarIKHint)1, playerBodyFootPlacementData.GetCurrentFootWeight());
				_playerBodyAnimator.SetIKHintPosition((AvatarIKHint)1, playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.TOE) + playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT) + playerBodyFootPlacementData.GetRotatedIKHint() + zero);
			}
			Vector3 val4 = playerBodyFootPlacementData.GetTargetPos(PlayerBodyFootPlacementData.Target.FOOT) + playerBodyFootPlacementData.mUpVector * playerBodyFootPlacementData.mFootHeight;
			_playerBodyAnimator.SetIKPositionWeight(foot_id, playerBodyFootPlacementData.GetCurrentFootWeight());
			_playerBodyAnimator.SetIKPosition(foot_id, val4);
			if (playerBodyFootPlacementData.GetCurrentFootWeight() <= 0f)
			{
				playerBodyFootPlacementData.SetFootPlanted(planted: false);
			}
			else if (playerBodyFootPlacementData.mPlantFoot && !playerBodyFootPlacementData.GetFootPlanted() && Mathf.Abs(playerBodyFootPlacementData.GetTargetFootWeight() - playerBodyFootPlacementData.GetCurrentFootWeight()) < 0.005f)
			{
				playerBodyFootPlacementData.SetPlantedPos(_playerBodyAnimator.GetIKPosition(foot_id));
				playerBodyFootPlacementData.SetPlantedRot(_playerBodyAnimator.GetIKRotation(foot_id));
				playerBodyFootPlacementData.SetFootPlanted(planted: true);
			}
		}

		private void UpdateLayerMask()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			for (byte b = 0; b < mLayersToIgnore.Length; b++)
			{
				int num = LayerMask.NameToLayer(mLayersToIgnore[b]);
				if (num != -1)
				{
					mLayerMask = LayerMask.op_Implicit(LayerMask.op_Implicit(mLayerMask) & ~Mathf.RoundToInt(Mathf.Pow(2f, (float)num)));
				}
			}
		}

		public void Start()
		{
			_playerBodyAnimator = ((Component)this).GetComponent<Animator>();
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			bool flag4 = false;
			PlayerBodyFootPlacementData[] components = ((Component)this).GetComponents<PlayerBodyFootPlacementData>();
			byte b = 0;
			while (b < components.Length)
			{
				switch (components[b].mFootID)
				{
				case PlayerBodyFootPlacementData.LimbID.LEFT_FOOT:
					flag = true;
					mLeftFoot = components[b];
					break;
				case PlayerBodyFootPlacementData.LimbID.RIGHT_FOOT:
					flag2 = true;
					mRightFoot = components[b];
					break;
				case PlayerBodyFootPlacementData.LimbID.RIGHT_HAND:
					flag4 = true;
					mLeftHand = components[b];
					break;
				case PlayerBodyFootPlacementData.LimbID.LEFT_HAND:
					flag3 = true;
					mRightHand = components[b];
					break;
				}
				if (!(flag && flag2 && flag3 && flag4))
				{
					b++;
					continue;
				}
				break;
			}
		}

		public void OnAnimatorIK()
		{
			UpdateLayerMask();
			if ((Object)(object)mLeftFoot != (Object)null)
			{
				FootPlacement((AvatarIKGoal)0);
			}
			if ((Object)(object)mRightFoot != (Object)null)
			{
				FootPlacement((AvatarIKGoal)1);
			}
			if ((Object)(object)mLeftHand != (Object)null)
			{
				FootPlacement((AvatarIKGoal)2);
			}
			if ((Object)(object)mRightHand != (Object)null)
			{
				FootPlacement((AvatarIKGoal)3);
			}
			RootPositioningCheck();
		}

		public void LateUpdate()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (mCurrentRootVertError != 0f)
			{
				if (mRootPosLeftRightFoot)
				{
					Transform boneTransform = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)0);
					boneTransform.position -= mRightFoot.mUpVector * mCurrentRootVertError;
				}
				else
				{
					Transform boneTransform2 = _playerBodyAnimator.GetBoneTransform((HumanBodyBones)0);
					boneTransform2.position -= mLeftFoot.mUpVector * mCurrentRootVertError;
				}
			}
		}
	}
	public class PlayerBodyHandController : MonoBehaviour
	{
		[Serializable]
		public class HandConfig
		{
			[Tooltip("Hand IK tracking positions: \n0 = no item in hands, \n1 = weapon grip, \n2 = magazine grip, \n3 = handguard grip, \n4 = bolt handle grip, \n5 = pistol slide grip, \n6 = bullet grip, \n7 = grenade grip, \n8 = pistol two-handed grip, \n9 = top cover grip.")]
			public Transform[] HandIKTargets;

			[Tooltip("Names of the transition bool that trigger the grab dependent finger animations: \n0 = weapon grip, \n1 = magazine grip, \n2 = handguard grip, \n3 = bolt handle grip, \n4 = pistol slide grip, \n5 = bullet grip, \n6 = grenade grip, \n7 = offhand two-handed pistol grip, \n8 = top cover grip.")]
			public string[] AnimatorBoolTransitionNames;

			[Tooltip("Name of the transition bool that triggers when pressing the trigger while holding a gun.")]
			public string TriggerPressedBoolTransitionName;

			[HideInInspector]
			public HandConfig OtherHandConfig;

			[HideInInspector]
			public bool TwoHandHolding;

			[HideInInspector]
			public FVRViveHand Controller;

			[HideInInspector]
			public Arm ConnectedIKArm;

			[HideInInspector]
			public FVRInteractiveObject CurrentInteractable => Controller.CurrentInteractable;

			[HideInInspector]
			public FVRViveHand OtherHand => Controller.OtherHand;

			[HideInInspector]
			public bool IsThisTheRightHand => Controller.IsThisTheRightHand;
		}

		[Header("This component controls how the hands move.")]
		[Header("Many fields have tooltips, just hover over them!")]
		[Header("(On the left side, where the name of the field is.)")]
		[Tooltip("H3MP Player Body reference used for determining player body state in multiplayer.")]
		public PlayerBody H3MPPlayerBody;

		[Tooltip("VRIK script, used to swap out hand IK target depending on what type of object is being grabbed.")]
		public VRIK VRIKInstance;

		[Tooltip("Animator on the player body rig.")]
		public Animator PlayerBodyAnimator;

		[Tooltip("Left Hand (Element 0), then right hand (Element 1).\nIf you have more than two hands, lucky you, if you have less, I'm sorry!\nHowever, this is sadly not supported!")]
		public HandConfig[] HandConfigs;

		[Header("In-Editor Debugging Settings")]
		[Header("Make sure to turn off before building your playerbody for in game use!)")]
		public bool InEditorDebuggingEnabled;

		[Header("Left Hand Debugging")]
		[Tooltip("Simulate left hand held item state:\n0 = no item in hands, \n1 = weapon grip, \n2 = magazine grip, \n3 = handguard grip, \n4 = bolt handle grip, \n5 = pistol slide grip, \n6 = bullet grip, \n7 = grenade grip, \n8 = pistol two-handed grip, \n9 = top cover grip.")]
		[Range(0f, 9f)]
		public int LeftHandDebuggingInteractableIndex;

		[Tooltip("Simulate trigger pressed while holding weapon.")]
		public bool LeftHandDebbuggingTriggerPressed;

		[Header("Right Hand Debugging")]
		[Tooltip("Simulate right hand held item state:\n0 = no item in hands, \n1 = weapon grip, \n2 = magazine grip, \n3 = handguard grip, \n4 = bolt handle grip, \n5 = pistol slide grip, \n6 = bullet grip, \n7 = grenade grip, \n8 = pistol two-handed grip, \n9 = top cover grip.")]
		[Range(0f, 9f)]
		public int RightHandDebuggingInteractableIndex;

		[Tooltip("Simulate trigger pressed while holding weapon.")]
		public bool RightHandDebbuggingTriggerPressed;

		private readonly string[] FingerNames = new string[5] { "Thumb", "Index", "Middle", "Ring", "Pinky" };

		public void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			if (HandConfigs.Length != 2)
			{
				Debug.LogError((object)(((object)this)?.ToString() + ": Either you have less than two hands, or more. If you have less, I'm sorry, if you have more, lucky you! In any case, this won't work with PlayerBodies. Sorry!"));
				return;
			}
			GameManager.OnPlayerBodyInit += new OnPlayerBodyInitDelegate(OnPlayerBodyInit);
			for (int i = 0; i < HandConfigs.Length; i++)
			{
				HandConfigs[i].ConnectedIKArm = ((i == 0) ? VRIKInstance.solver.leftArm : VRIKInstance.solver.rightArm);
				HandConfigs[i].OtherHandConfig = HandConfigs[1 - i];
			}
		}

		public void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			GameManager.OnPlayerBodyInit -= new OnPlayerBodyInitDelegate(OnPlayerBodyInit);
		}

		public void Start()
		{
			if (InEditorDebuggingEnabled)
			{
				return;
			}
			FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody;
			if ((Object)(object)Mod.managerObject == (Object)null)
			{
				for (int i = 0; i < HandConfigs.Length; i++)
				{
					HandConfigs[i].Controller = ((i == 0) ? ((Component)currentPlayerBody.LeftHand).GetComponent<FVRViveHand>() : ((Component)currentPlayerBody.RightHand).GetComponent<FVRViveHand>());
				}
			}
			else if ((Object)(object)GameManager.currentPlayerBody == (Object)(object)H3MPPlayerBody)
			{
				for (int j = 0; j < HandConfigs.Length; j++)
				{
					HandConfigs[j].Controller = ((j == 0) ? ((Component)currentPlayerBody.LeftHand).GetComponent<FVRViveHand>() : ((Component)currentPlayerBody.RightHand).GetComponent<FVRViveHand>());
				}
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}

		public void OnPlayerBodyInit(FVRPlayerBody playerBody)
		{
			for (int i = 0; i < HandConfigs.Length; i++)
			{
				HandConfigs[i].Controller = ((i == 0) ? ((Component)playerBody.LeftHand).GetComponent<FVRViveHand>() : ((Component)playerBody.RightHand).GetComponent<FVRViveHand>());
			}
		}

		public void Update()
		{
			if (!InEditorDebuggingEnabled && HandConfigs.All((HandConfig hc) => (Object)(object)hc.Controller != (Object)null))
			{
				HandConfig[] handConfigs = HandConfigs;
				foreach (HandConfig config in handConfigs)
				{
					CheckIfItemInHand(config);
				}
			}
			else if (InEditorDebuggingEnabled)
			{
				for (int j = 0; j < HandConfigs.Length; j++)
				{
					DebuggingHandsAnimationControl(HandConfigs[j], j);
				}
			}
		}

		private void UpdateFingerTracking(HandConfig config)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			HandInput input = config.Controller.Input;
			float[] array = new float[5] { input.FingerCurl_Thumb, input.FingerCurl_Index, input.FingerCurl_Middle, input.FingerCurl_Ring, input.FingerCurl_Pinky };
			string text = (config.IsThisTheRightHand ? "Right " : "Left ");
			for (int i = 0; i < FingerNames.Length; i++)
			{
				PlayerBodyAnimator.SetFloat(text + FingerNames[i], array[i]);
			}
		}

		private void CheckIfItemInHand(HandConfig config)
		{
			if ((Object)(object)config.CurrentInteractable != (Object)null)
			{
				UpdateIKTargetAndAnimate(config);
				return;
			}
			if ((Object)(object)config.OtherHand.CurrentInteractable != (Object)null && (Object)(object)config.CurrentInteractable == (Object)null