510 lines
15 KiB
C#
510 lines
15 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Cpp2IlInjected;
|
|
using UnityEngine;
|
|
|
|
namespace RootMotion.FinalIK
|
|
{
|
|
// Token: 0x0200045C RID: 1116
|
|
[Token(Token = "0x200045C")]
|
|
[RequireComponent(typeof(Animator))]
|
|
public class RagdollUtility : MonoBehaviour
|
|
{
|
|
// Token: 0x0600282E RID: 10286 RVA: 0x00058D8C File Offset: 0x00056F8C
|
|
[Token(Token = "0x600282E")]
|
|
[Address(RVA = "0xBE4430", Offset = "0xBE3230", VA = "0x180BE4430")]
|
|
public void EnableRagdoll()
|
|
{
|
|
if (this.rigidbones[0].r.isKinematic || this.animator.enabled)
|
|
{
|
|
base.StopAllCoroutines();
|
|
this.enableRagdollFlag = true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600282F RID: 10287 RVA: 0x00058DD4 File Offset: 0x00056FD4
|
|
[Token(Token = "0x600282F")]
|
|
[Address(RVA = "0xBE42E0", Offset = "0xBE30E0", VA = "0x180BE42E0")]
|
|
public void DisableRagdoll()
|
|
{
|
|
if (!this.rigidbones[0].r.isKinematic && !this.animator.enabled)
|
|
{
|
|
RagdollUtility.Child[] array = this.children;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num < length)
|
|
{
|
|
array[num].StoreLocalState();
|
|
num++;
|
|
}
|
|
base.StopAllCoroutines();
|
|
int num2;
|
|
RagdollUtility.<DisableRagdollSmooth>d__21 <DisableRagdollSmooth>d__ = new RagdollUtility.<DisableRagdollSmooth>d__21(num2);
|
|
num2 = 0;
|
|
<DisableRagdollSmooth>d__.<>4__this = this;
|
|
Coroutine coroutine = base.StartCoroutine(<DisableRagdollSmooth>d__);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06002830 RID: 10288 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002830")]
|
|
[Address(RVA = "0xBE4CA0", Offset = "0xBE3AA0", VA = "0x180BE4CA0")]
|
|
public void Start()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002831 RID: 10289 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002831")]
|
|
[Address(RVA = "0xBE4270", Offset = "0xBE3070", VA = "0x180BE4270")]
|
|
private IEnumerator DisableRagdollSmooth()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002832 RID: 10290 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002832")]
|
|
[Address(RVA = "0xBE5210", Offset = "0xBE4010", VA = "0x180BE5210")]
|
|
private void Update()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002833 RID: 10291 RVA: 0x00058E54 File Offset: 0x00057054
|
|
[Token(Token = "0x6002833")]
|
|
[Address(RVA = "0xBE4520", Offset = "0xBE3320", VA = "0x180BE4520")]
|
|
private void FixedUpdate()
|
|
{
|
|
if (!this.rigidbones[0].r.isKinematic)
|
|
{
|
|
bool enabled = this.animator.enabled;
|
|
if (!enabled && this.applyIkOnRagdoll != enabled)
|
|
{
|
|
this.FixTransforms(1f);
|
|
}
|
|
}
|
|
this.fixedFrame = true;
|
|
}
|
|
|
|
// Token: 0x06002834 RID: 10292 RVA: 0x00058EAC File Offset: 0x000570AC
|
|
[Token(Token = "0x6002834")]
|
|
[Address(RVA = "0xBE45B0", Offset = "0xBE33B0", VA = "0x180BE45B0")]
|
|
private void LateUpdate()
|
|
{
|
|
if (this.animator.updateMode != AnimatorUpdateMode.AnimatePhysics || (this.animator.updateMode == AnimatorUpdateMode.AnimatePhysics && this.fixedFrame))
|
|
{
|
|
if (!this.rigidbones[0].r.isKinematic && !this.animator.enabled)
|
|
{
|
|
RagdollUtility.Child[] array = this.children;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num >= length)
|
|
{
|
|
goto IL_7E;
|
|
}
|
|
array[num].StoreLocalState();
|
|
num++;
|
|
}
|
|
float num2 = this.ragdollWeight;
|
|
this.FixTransforms(num2);
|
|
}
|
|
IL_7E:
|
|
this.fixedFrame = false;
|
|
if (!this.ikUsed)
|
|
{
|
|
this.OnFinalPose();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06002835 RID: 10293 RVA: 0x00058F54 File Offset: 0x00057154
|
|
[Token(Token = "0x6002835")]
|
|
[Address(RVA = "0xBE4240", Offset = "0xBE3040", VA = "0x180BE4240")]
|
|
private void AfterLastIK()
|
|
{
|
|
if (this.ikUsed)
|
|
{
|
|
this.OnFinalPose();
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06002836 RID: 10294 RVA: 0x00058F74 File Offset: 0x00057174
|
|
[Token(Token = "0x6002836")]
|
|
[Address(RVA = "0xBE4170", Offset = "0xBE2F70", VA = "0x180BE4170")]
|
|
private void AfterAnimation()
|
|
{
|
|
if (!this.rigidbones[0].r.isKinematic && !this.animator.enabled)
|
|
{
|
|
RagdollUtility.Child[] array = this.children;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num >= length)
|
|
{
|
|
return;
|
|
}
|
|
array[num].StoreLocalState();
|
|
num++;
|
|
}
|
|
float num2 = this.ragdollWeight;
|
|
this.FixTransforms(num2);
|
|
}
|
|
|
|
// Token: 0x06002837 RID: 10295 RVA: 0x00058FE0 File Offset: 0x000571E0
|
|
[Token(Token = "0x6002837")]
|
|
[Address(RVA = "0xBE4820", Offset = "0xBE3620", VA = "0x180BE4820")]
|
|
private void OnFinalPose()
|
|
{
|
|
if (this.rigidbones[0].r.isKinematic || this.animator.enabled)
|
|
{
|
|
RagdollUtility.Rigidbone[] array = this.rigidbones;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num < length)
|
|
{
|
|
array[num].RecordVelocity();
|
|
num++;
|
|
}
|
|
}
|
|
if (this.enableRagdollFlag)
|
|
{
|
|
this.RagdollEnabler();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06002838 RID: 10296 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002838")]
|
|
[Address(RVA = "0xBE4900", Offset = "0xBE3700", VA = "0x180BE4900")]
|
|
private void RagdollEnabler()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x17000285 RID: 645
|
|
// (get) Token: 0x06002839 RID: 10297 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x17000285")]
|
|
private bool isRagdoll
|
|
{
|
|
[Token(Token = "0x6002839")]
|
|
[Address(RVA = "0xBE57F0", Offset = "0xBE45F0", VA = "0x180BE57F0")]
|
|
get
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600283A RID: 10298 RVA: 0x00059050 File Offset: 0x00057250
|
|
[Token(Token = "0x600283A")]
|
|
[Address(RVA = "0xBE4C40", Offset = "0xBE3A40", VA = "0x180BE4C40")]
|
|
private void RecordVelocities()
|
|
{
|
|
RagdollUtility.Rigidbone[] array = this.rigidbones;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num < length)
|
|
{
|
|
array[num].RecordVelocity();
|
|
num++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000286 RID: 646
|
|
// (get) Token: 0x0600283B RID: 10299 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x17000286")]
|
|
private bool ikUsed
|
|
{
|
|
[Token(Token = "0x600283B")]
|
|
[Address(RVA = "0xBE56A0", Offset = "0xBE44A0", VA = "0x180BE56A0")]
|
|
get
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600283C RID: 10300 RVA: 0x00059088 File Offset: 0x00057288
|
|
[Token(Token = "0x600283C")]
|
|
[Address(RVA = "0xBE51B0", Offset = "0xBE3FB0", VA = "0x180BE51B0")]
|
|
private void StoreLocalState()
|
|
{
|
|
RagdollUtility.Child[] array = this.children;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num < length)
|
|
{
|
|
array[num].StoreLocalState();
|
|
num++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600283D RID: 10301 RVA: 0x000590C0 File Offset: 0x000572C0
|
|
[Token(Token = "0x600283D")]
|
|
[Address(RVA = "0xBE44B0", Offset = "0xBE32B0", VA = "0x180BE44B0")]
|
|
private void FixTransforms(float weight)
|
|
{
|
|
RagdollUtility.Child[] array = this.children;
|
|
int num = 0;
|
|
int length = array.Length;
|
|
if (num < length)
|
|
{
|
|
array[num].FixTransform(weight);
|
|
num++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600283E RID: 10302 RVA: 0x000590F8 File Offset: 0x000572F8
|
|
[Token(Token = "0x600283E")]
|
|
[Address(RVA = "0xBE46F0", Offset = "0xBE34F0", VA = "0x180BE46F0")]
|
|
private void OnDestroy()
|
|
{
|
|
IK ik = this.ik;
|
|
int num = 0;
|
|
if (ik != num)
|
|
{
|
|
IKSolver iksolver = this.ik.GetIKSolver();
|
|
IKSolver.UpdateDelegate onPostUpdate = iksolver.OnPostUpdate;
|
|
IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.AfterLastIK);
|
|
Delegate @delegate = Delegate.Remove(onPostUpdate, updateDelegate);
|
|
int num2 = 0;
|
|
if (@delegate != 0 && @delegate == 0)
|
|
{
|
|
throw new InvalidCastException();
|
|
}
|
|
iksolver.OnPostUpdate = num2;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600283F RID: 10303 RVA: 0x00059164 File Offset: 0x00057364
|
|
[Token(Token = "0x600283F")]
|
|
[Address(RVA = "0xBE55A0", Offset = "0xBE43A0", VA = "0x180BE55A0")]
|
|
public RagdollUtility()
|
|
{
|
|
int num = 0;
|
|
this.applyVelocity = 1f;
|
|
this.applyAngularVelocity = 1f;
|
|
RagdollUtility.Rigidbone[] array = new RagdollUtility.Rigidbone[num];
|
|
this.rigidbones = array;
|
|
RagdollUtility.Child[] array2 = new RagdollUtility.Child[0];
|
|
this.children = array2;
|
|
IK[] array3 = new IK[0];
|
|
this.allIKComponents = array3;
|
|
bool[] array4 = new bool[0];
|
|
this.fixTransforms = array4;
|
|
bool[] array5 = new bool[0];
|
|
this.disabledIKComponents = array5;
|
|
base..ctor();
|
|
}
|
|
|
|
// Token: 0x0400318A RID: 12682
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400318A")]
|
|
[Tooltip("If you have multiple IK components, then this should be the one that solves last each frame.")]
|
|
public IK ik;
|
|
|
|
// Token: 0x0400318B RID: 12683
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400318B")]
|
|
[Tooltip("How long does it take to blend from ragdoll to animation?")]
|
|
public float ragdollToAnimationTime = 0.2f;
|
|
|
|
// Token: 0x0400318C RID: 12684
|
|
[FieldOffset(Offset = "0x24")]
|
|
[Token(Token = "0x400318C")]
|
|
[Tooltip("If true, IK can be used on top of physical ragdoll simulation.")]
|
|
public bool applyIkOnRagdoll;
|
|
|
|
// Token: 0x0400318D RID: 12685
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400318D")]
|
|
[Tooltip("How much velocity transfer from animation to ragdoll?")]
|
|
public float applyVelocity;
|
|
|
|
// Token: 0x0400318E RID: 12686
|
|
[FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x400318E")]
|
|
[Tooltip("How much angular velocity to transfer from animation to ragdoll?")]
|
|
public float applyAngularVelocity;
|
|
|
|
// Token: 0x0400318F RID: 12687
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400318F")]
|
|
private Animator animator;
|
|
|
|
// Token: 0x04003190 RID: 12688
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4003190")]
|
|
private RagdollUtility.Rigidbone[] rigidbones;
|
|
|
|
// Token: 0x04003191 RID: 12689
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4003191")]
|
|
private RagdollUtility.Child[] children;
|
|
|
|
// Token: 0x04003192 RID: 12690
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4003192")]
|
|
private bool enableRagdollFlag;
|
|
|
|
// Token: 0x04003193 RID: 12691
|
|
[FieldOffset(Offset = "0x4C")]
|
|
[Token(Token = "0x4003193")]
|
|
private AnimatorUpdateMode animatorUpdateMode;
|
|
|
|
// Token: 0x04003194 RID: 12692
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x4003194")]
|
|
private IK[] allIKComponents;
|
|
|
|
// Token: 0x04003195 RID: 12693
|
|
[FieldOffset(Offset = "0x58")]
|
|
[Token(Token = "0x4003195")]
|
|
private bool[] fixTransforms;
|
|
|
|
// Token: 0x04003196 RID: 12694
|
|
[FieldOffset(Offset = "0x60")]
|
|
[Token(Token = "0x4003196")]
|
|
private float ragdollWeight;
|
|
|
|
// Token: 0x04003197 RID: 12695
|
|
[FieldOffset(Offset = "0x64")]
|
|
[Token(Token = "0x4003197")]
|
|
private float ragdollWeightV;
|
|
|
|
// Token: 0x04003198 RID: 12696
|
|
[FieldOffset(Offset = "0x68")]
|
|
[Token(Token = "0x4003198")]
|
|
private bool fixedFrame;
|
|
|
|
// Token: 0x04003199 RID: 12697
|
|
[FieldOffset(Offset = "0x70")]
|
|
[Token(Token = "0x4003199")]
|
|
private bool[] disabledIKComponents;
|
|
|
|
// Token: 0x0200045D RID: 1117
|
|
[Token(Token = "0x200045D")]
|
|
public class Rigidbone
|
|
{
|
|
// Token: 0x06002840 RID: 10304 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002840")]
|
|
[Address(RVA = "0x6A1750", Offset = "0x6A0550", VA = "0x1806A1750")]
|
|
public Rigidbone(Rigidbody r)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002841 RID: 10305 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002841")]
|
|
[Address(RVA = "0x6A1380", Offset = "0x6A0180", VA = "0x1806A1380")]
|
|
public void RecordVelocity()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002842 RID: 10306 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002842")]
|
|
[Address(RVA = "0x6A14C0", Offset = "0x6A02C0", VA = "0x1806A14C0")]
|
|
public void WakeUp(float velocityWeight, float angularVelocityWeight)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0400319A RID: 12698
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400319A")]
|
|
public Rigidbody r;
|
|
|
|
// Token: 0x0400319B RID: 12699
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400319B")]
|
|
public Transform t;
|
|
|
|
// Token: 0x0400319C RID: 12700
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400319C")]
|
|
public Collider collider;
|
|
|
|
// Token: 0x0400319D RID: 12701
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400319D")]
|
|
public Joint joint;
|
|
|
|
// Token: 0x0400319E RID: 12702
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400319E")]
|
|
public Rigidbody c;
|
|
|
|
// Token: 0x0400319F RID: 12703
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400319F")]
|
|
public bool updateAnchor;
|
|
|
|
// Token: 0x040031A0 RID: 12704
|
|
[FieldOffset(Offset = "0x3C")]
|
|
[Token(Token = "0x40031A0")]
|
|
public Vector3 deltaPosition;
|
|
|
|
// Token: 0x040031A1 RID: 12705
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40031A1")]
|
|
public Quaternion deltaRotation;
|
|
|
|
// Token: 0x040031A2 RID: 12706
|
|
[FieldOffset(Offset = "0x58")]
|
|
[Token(Token = "0x40031A2")]
|
|
public float deltaTime;
|
|
|
|
// Token: 0x040031A3 RID: 12707
|
|
[FieldOffset(Offset = "0x5C")]
|
|
[Token(Token = "0x40031A3")]
|
|
public Vector3 lastPosition;
|
|
|
|
// Token: 0x040031A4 RID: 12708
|
|
[FieldOffset(Offset = "0x68")]
|
|
[Token(Token = "0x40031A4")]
|
|
public Quaternion lastRotation;
|
|
}
|
|
|
|
// Token: 0x0200045E RID: 1118
|
|
[Token(Token = "0x200045E")]
|
|
public class Child
|
|
{
|
|
// Token: 0x06002843 RID: 10307 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002843")]
|
|
[Address(RVA = "0x69B9E0", Offset = "0x69A7E0", VA = "0x18069B9E0")]
|
|
public Child(Transform transform)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002844 RID: 10308 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002844")]
|
|
[Address(RVA = "0x69B7C0", Offset = "0x69A5C0", VA = "0x18069B7C0")]
|
|
public void FixTransform(float weight)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002845 RID: 10309 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002845")]
|
|
[Address(RVA = "0x69B980", Offset = "0x69A780", VA = "0x18069B980")]
|
|
public void StoreLocalState()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x040031A5 RID: 12709
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40031A5")]
|
|
public Transform t;
|
|
|
|
// Token: 0x040031A6 RID: 12710
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40031A6")]
|
|
public Vector3 localPosition;
|
|
|
|
// Token: 0x040031A7 RID: 12711
|
|
[FieldOffset(Offset = "0x24")]
|
|
[Token(Token = "0x40031A7")]
|
|
public Quaternion localRotation;
|
|
}
|
|
}
|
|
}
|