111 lines
3.5 KiB
C#
111 lines
3.5 KiB
C#
using System;
|
|
using Cpp2IlInjected;
|
|
using RootMotion.FinalIK;
|
|
using UnityEngine;
|
|
|
|
namespace RootMotion.Demos
|
|
{
|
|
// Token: 0x02000431 RID: 1073
|
|
[Token(Token = "0x2000431")]
|
|
public class TwoHandedProp : MonoBehaviour
|
|
{
|
|
// Token: 0x06002687 RID: 9863 RVA: 0x00058CDC File Offset: 0x00056EDC
|
|
[Token(Token = "0x6002687")]
|
|
[Address(RVA = "0x19CF9A0", Offset = "0x19CE9A0", VA = "0x1819CF9A0")]
|
|
private void Start()
|
|
{
|
|
FullBodyBipedIK component = base.GetComponent<FullBodyBipedIK>();
|
|
this.ik = component;
|
|
IKSolverFullBodyBiped solver = this.ik.solver;
|
|
IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.AfterFBBIK);
|
|
Delegate @delegate = Delegate.Combine(updateDelegate, updateDelegate);
|
|
int num = 0;
|
|
if (@delegate == 0 || @delegate != 0)
|
|
{
|
|
solver.OnPostUpdate = num;
|
|
this.ik.solver.leftHandEffector.positionWeight = 1f;
|
|
this.ik.solver.rightHandEffector.positionWeight = 1f;
|
|
Transform target = this.ik.solver.rightHandEffector.target;
|
|
int num2 = 0;
|
|
if (target == num2)
|
|
{
|
|
Debug.LogError("Right Hand Effector needs a Target in this demo.");
|
|
}
|
|
return;
|
|
}
|
|
throw new InvalidCastException();
|
|
}
|
|
|
|
// Token: 0x06002688 RID: 9864 RVA: 0x000020D3 File Offset: 0x000002D3
|
|
[Token(Token = "0x6002688")]
|
|
[Address(RVA = "0x19CF570", Offset = "0x19CE570", VA = "0x1819CF570")]
|
|
private void LateUpdate()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06002689 RID: 9865 RVA: 0x00058D9C File Offset: 0x00056F9C
|
|
[Token(Token = "0x6002689")]
|
|
[Address(RVA = "0x19CF470", Offset = "0x19CE470", VA = "0x1819CF470")]
|
|
private void AfterFBBIK()
|
|
{
|
|
Transform bone = this.ik.solver.leftHandEffector.bone;
|
|
Quaternion rotation = this.ik.solver.leftHandEffector.rotation;
|
|
bone.rotation = rotation;
|
|
Transform bone2 = this.ik.solver.rightHandEffector.bone;
|
|
Quaternion rotation2 = this.ik.solver.rightHandEffector.rotation;
|
|
bone2.rotation = rotation2;
|
|
}
|
|
|
|
// Token: 0x0600268A RID: 9866 RVA: 0x00058E18 File Offset: 0x00057018
|
|
[Token(Token = "0x600268A")]
|
|
[Address(RVA = "0x19CF880", Offset = "0x19CE880", VA = "0x1819CF880")]
|
|
private void OnDestroy()
|
|
{
|
|
FullBodyBipedIK fullBodyBipedIK = this.ik;
|
|
int num = 0;
|
|
if (fullBodyBipedIK != num)
|
|
{
|
|
IKSolverFullBodyBiped solver = this.ik.solver;
|
|
IKSolver.UpdateDelegate onPostUpdate = solver.OnPostUpdate;
|
|
IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.AfterFBBIK);
|
|
Delegate @delegate = Delegate.Remove(onPostUpdate, updateDelegate);
|
|
int num2 = 0;
|
|
if (@delegate != 0 && @delegate == 0)
|
|
{
|
|
throw new InvalidCastException();
|
|
}
|
|
solver.OnPostUpdate = num2;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600268B RID: 9867 RVA: 0x00058E84 File Offset: 0x00057084
|
|
[Token(Token = "0x600268B")]
|
|
[Address(RVA = "0x328C40", Offset = "0x327C40", VA = "0x180328C40")]
|
|
public TwoHandedProp()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400303C RID: 12348
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400303C")]
|
|
[Tooltip("The left hand target parented to the right hand.")]
|
|
public Transform leftHandTarget;
|
|
|
|
// Token: 0x0400303D RID: 12349
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400303D")]
|
|
private FullBodyBipedIK ik;
|
|
|
|
// Token: 0x0400303E RID: 12350
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400303E")]
|
|
private Vector3 targetPosRelativeToRight;
|
|
|
|
// Token: 0x0400303F RID: 12351
|
|
[FieldOffset(Offset = "0x34")]
|
|
[Token(Token = "0x400303F")]
|
|
private Quaternion targetRotRelativeToRight;
|
|
}
|
|
}
|