private void RestoreFromProfile(TransformProfile profile) { if (profile == null) { throw new InvalidOperationException(); } CapsuleColliderProfile maybeCapsule = profile as CapsuleColliderProfile; if (maybeCapsule != null) { CapsuleCollider c = capsulePool.TakeComponent(); maybeCapsule.RestoreSelfToCollider(c); return; } BoxColliderProfile maybeBox = profile as BoxColliderProfile; if (maybeBox != null) { BoxCollider c = boxPool.TakeComponent(); maybeBox.RestoreSelfToCollider(c); return; } SphereColliderProfile maybeSphere = profile as SphereColliderProfile; if (profile != null) { SphereCollider c = spherePool.TakeComponent(); maybeSphere.RestoreSelfToCollider(c); return; } throw new InvalidOperationException("howdafuq do we have an invalid collider profile? got: " + profile.GetType().ToString() + " maybeCapsule: " + maybeCapsule + " maybeBox: " + maybeBox); }