private void Cleanup()
{
IEnumerator enumerator = this.bones.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
BoneInfo current = (BoneInfo) enumerator.Current;
if (current.anchor != null)
{
Component[] componentsInChildren = current.anchor.GetComponentsInChildren(typeof(Joint));
foreach (Joint joint in componentsInChildren)
{
Object.DestroyImmediate(joint);
}
Component[] componentArray3 = current.anchor.GetComponentsInChildren(typeof(Rigidbody));
foreach (Rigidbody rigidbody in componentArray3)
{
Object.DestroyImmediate(rigidbody);
}
Component[] componentArray5 = current.anchor.GetComponentsInChildren(typeof(Collider));
foreach (Collider collider in componentArray5)
{
Object.DestroyImmediate(collider);
}
}
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
}