Skip to content

Commit

Permalink
VRBoop cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Keelhauled committed Oct 5, 2023
1 parent ea86689 commit 75e8d5d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Shared/Features/VRBoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ public static class VRBoop
private static DynamicBoneCollider _leftCollider;
private static DynamicBoneCollider _rightCollider;

private static Harmony _hi;

public static void Initialize(Controller controller, EyeSide controllerSide)
{
// Hooks in here don't get patched by the whole assembly PatchAll since the class has no HarmonyPatch attribute
if (_hi == null)
_hi = Harmony.CreateAndPatchAll(typeof(VRBoop), typeof(VRBoop).FullName);
Harmony.CreateAndPatchAll(typeof(VRBoop), typeof(VRBoop).FullName);

switch (controllerSide)
{
Expand Down Expand Up @@ -90,14 +87,14 @@ private static void AttachControllerColliders(List<DynamicBoneCollider> collider

private static List<DynamicBoneCollider> GetColliderList(MonoBehaviour dynamicBone)
{
switch (dynamicBone)
return dynamicBone switch
{
case DynamicBone d: return d.m_Colliders;
case DynamicBone_Ver01 d: return d.m_Colliders;
case DynamicBone_Ver02 d: return d.Colliders;
case null: throw new ArgumentNullException(nameof(dynamicBone));
default: throw new ArgumentException(@"Not a DynamicBone - " + dynamicBone.GetType(), nameof(dynamicBone));
}
DynamicBone d => d.m_Colliders,
DynamicBone_Ver01 d => d.m_Colliders,
DynamicBone_Ver02 d => d.Colliders,
null => throw new ArgumentNullException(nameof(dynamicBone)),
_ => throw new ArgumentException(@"Not a DynamicBone - " + dynamicBone.GetType(), nameof(dynamicBone)),
};
}

private static DynamicBoneCollider GetOrAttachCollider(GameObject controllerGameObject, string colliderName)
Expand Down

0 comments on commit 75e8d5d

Please sign in to comment.