You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
196 lines
4.8 KiB
196 lines
4.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace MU3
|
|
{
|
|
// Token: 0x020004E4 RID: 1252
|
|
[AddComponentMenu("MU3/SwingJoint/Manager", 1)]
|
|
public class SwingJointManager : MonoBehaviour
|
|
{
|
|
// Token: 0x17000375 RID: 885
|
|
// (get) Token: 0x06001EE9 RID: 7913 RVA: 0x000C3414 File Offset: 0x000C3414
|
|
public SwingJointCollider[] colliders
|
|
{
|
|
get
|
|
{
|
|
return this._colliders;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000376 RID: 886
|
|
// (get) Token: 0x06001EEA RID: 7914 RVA: 0x000C341C File Offset: 0x000C341C
|
|
public bool overwriteRadius
|
|
{
|
|
get
|
|
{
|
|
return this._overwriteRadius;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000377 RID: 887
|
|
// (get) Token: 0x06001EEB RID: 7915 RVA: 0x000C3424 File Offset: 0x000C3424
|
|
public float collisionRadius
|
|
{
|
|
get
|
|
{
|
|
return this._collisionRadius;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000378 RID: 888
|
|
// (get) Token: 0x06001EEC RID: 7916 RVA: 0x000C342C File Offset: 0x000C342C
|
|
public bool overwriteDynamic
|
|
{
|
|
get
|
|
{
|
|
return this._overwriteDynamic;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000379 RID: 889
|
|
// (get) Token: 0x06001EED RID: 7917 RVA: 0x000C3434 File Offset: 0x000C3434
|
|
public float childPullForce
|
|
{
|
|
get
|
|
{
|
|
return this._childPullForce;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700037A RID: 890
|
|
// (get) Token: 0x06001EEE RID: 7918 RVA: 0x000C343C File Offset: 0x000C343C
|
|
public float inertialForce
|
|
{
|
|
get
|
|
{
|
|
return this._inertialForce;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700037B RID: 891
|
|
// (get) Token: 0x06001EEF RID: 7919 RVA: 0x000C3444 File Offset: 0x000C3444
|
|
public bool overwriteStatic
|
|
{
|
|
get
|
|
{
|
|
return this._overwriteStatic;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700037C RID: 892
|
|
// (get) Token: 0x06001EF0 RID: 7920 RVA: 0x000C344C File Offset: 0x000C344C
|
|
public Vector3 staticForce
|
|
{
|
|
get
|
|
{
|
|
return this._staticForce;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001EF1 RID: 7921 RVA: 0x000C3454 File Offset: 0x000C3454
|
|
public SwingJointColliderInformation[] getCollideCandidates(out int start, out int end, Vector3 position, float radius)
|
|
{
|
|
return this._simpleKDTree.getCollideCandidates(out start, out end, position, radius);
|
|
}
|
|
|
|
// Token: 0x06001EF2 RID: 7922 RVA: 0x000C3468 File Offset: 0x000C3468
|
|
private void Awake()
|
|
{
|
|
Transform transform = base.transform;
|
|
List<SwingJoint> temporary = new List<SwingJoint>(4);
|
|
this.searchNode(transform, temporary);
|
|
this._colliders = transform.root.GetComponentsInChildren<SwingJointCollider>();
|
|
this._colliderInformation = new SwingJointColliderInformation[this._colliders.Length];
|
|
this._simpleKDTree.initialize(this._colliderInformation);
|
|
}
|
|
|
|
// Token: 0x06001EF3 RID: 7923 RVA: 0x000C34C0 File Offset: 0x000C34C0
|
|
private void OnEnable()
|
|
{
|
|
this._centerNode = null;
|
|
for (int i = 0; i < this._colliders.Length; i++)
|
|
{
|
|
if (this._colliders[i].gameObject.name.StartsWith("spine"))
|
|
{
|
|
this._centerNode = this._colliders[i].transform;
|
|
break;
|
|
}
|
|
}
|
|
if (null == this._centerNode)
|
|
{
|
|
this._centerNode = base.transform;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001EF4 RID: 7924 RVA: 0x000C3544 File Offset: 0x000C3544
|
|
private void LateUpdate()
|
|
{
|
|
for (int i = 0; i < this._colliders.Length; i++)
|
|
{
|
|
this._colliders[i].updateCache(ref this._colliderInformation[i]);
|
|
}
|
|
this._simpleKDTree.update(this._centerNode);
|
|
for (int j = 0; j < this._joints.Count; j++)
|
|
{
|
|
if (this._joints[j].gameObject.activeInHierarchy)
|
|
{
|
|
this._joints[j].update();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001EF5 RID: 7925 RVA: 0x000C35DC File Offset: 0x000C35DC
|
|
private void searchNode(Transform t, List<SwingJoint> temporary)
|
|
{
|
|
temporary.Clear();
|
|
t.GetComponents<SwingJoint>(temporary);
|
|
this._joints.AddRange(temporary);
|
|
for (int i = 0; i < t.childCount; i++)
|
|
{
|
|
Transform child = t.GetChild(i);
|
|
if (child.gameObject.GetComponent<SwingJointManager>() == null)
|
|
{
|
|
this.searchNode(child, temporary);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x040048FF RID: 18687
|
|
public bool _overwriteRadius;
|
|
|
|
// Token: 0x04004900 RID: 18688
|
|
public float _collisionRadius = 0.05f;
|
|
|
|
// Token: 0x04004901 RID: 18689
|
|
public bool _overwriteDynamic;
|
|
|
|
// Token: 0x04004902 RID: 18690
|
|
public float _childPullForce = 0.01f;
|
|
|
|
// Token: 0x04004903 RID: 18691
|
|
public float _inertialForce = 0.4f;
|
|
|
|
// Token: 0x04004904 RID: 18692
|
|
public bool _overwriteStatic;
|
|
|
|
// Token: 0x04004905 RID: 18693
|
|
public Vector3 _staticForce = new Vector3(0f, -0.0001f, 0f);
|
|
|
|
// Token: 0x04004906 RID: 18694
|
|
private List<SwingJoint> _joints = new List<SwingJoint>();
|
|
|
|
// Token: 0x04004907 RID: 18695
|
|
private SwingJointCollider[] _colliders;
|
|
|
|
// Token: 0x04004908 RID: 18696
|
|
private SwingJointColliderInformation[] _colliderInformation;
|
|
|
|
// Token: 0x04004909 RID: 18697
|
|
private Transform _centerNode;
|
|
|
|
// Token: 0x0400490A RID: 18698
|
|
private SimpleKDTree _simpleKDTree;
|
|
}
|
|
}
|