Exemplo n.º 1
0
        static void Postfix(MWS_ChargeUp __instance)
        {
            if (Controllers.mainControllerPose.GetVelocity().magnitude > 0.5f)
            {
                Collider[] enemyColliders      = Physics.OverlapSphere(__instance.m_weapon.ModelData.m_damageRefAttack.position, VRHammer.hammerSizeMult * .75f, LayerManager.MASK_ENEMY_DAMAGABLE);
                bool       shouldReleaseCharge = enemyColliders.Length > 0;
                if (GTFO_VR_Plugin.DEBUG_ENABLED)
                {
                    if (VRConfig.configDebugShowHammerHitbox.Value)
                    {
                        DebugDraw3D.DrawSphere(__instance.m_weapon.ModelData.m_damageRefAttack.position, VRHammer.hammerSizeMult * .75f, ColorExt.Blue(0.2f));
                        DebugDraw3D.DrawSphere(__instance.m_weapon.ModelData.m_damageRefAttack.position, VRHammer.hammerSizeMult * .25f, ColorExt.Red(0.2f));
                    }
                }
                if (Controllers.mainControllerPose.GetVelocity().magnitude > 1.6f)
                {
                    Collider[] staticColliders = Physics.OverlapSphere(__instance.m_weapon.ModelData.m_damageRefAttack.position, VRHammer.hammerSizeMult * .25f, LayerManager.MASK_MELEE_ATTACK_TARGETS_WITH_STATIC);
                    shouldReleaseCharge = shouldReleaseCharge || staticColliders.Length > 0;
                }

                if (shouldReleaseCharge)
                {
                    __instance.OnChargeupRelease();
                }
            }
        }
Exemplo n.º 2
0
        private bool AreControllersWithinDoubleHandStartDistance()
        {
            if (ItemEquippableEvents.IsCurrentItemShootableWeapon())
            {
                ItemEquippable currentHeldItem = ItemEquippableEvents.currentItem;
                if (currentHeldItem.LeftHandGripTrans)
                {
                    Vector3 correctedGripPosition = ItemEquippableEvents.GetCorrectedGripPosition();

                    if (GTFO_VR_Plugin.DEBUG_ENABLED)
                    {
                        if (VRConfig.configDebugShowTwoHHitboxes.Value)
                        {
                            DebugDraw3D.DrawSphere(correctedGripPosition, m_doubleHandStartDistance, ColorExt.Blue(0.2f));
                        }
                    }

                    return(Vector3.Distance(offhandController.transform.position, ItemEquippableEvents.GetCorrectedGripPosition()) < m_doubleHandStartDistance);
                }
            }

            return(Vector3.Distance(mainController.transform.position, offhandController.transform.position) < m_doubleHandStartDistance);
        }
Exemplo n.º 3
0
 private bool AreControllersOutsideOfDoubleHandExitDistance()
 {
     if (ItemEquippableEvents.IsCurrentItemShootableWeapon())
     {
         ItemEquippable currentHeldItem = ItemEquippableEvents.currentItem;
         if (currentHeldItem.IsReloading)
         {
             return(false);
         }
         if (currentHeldItem.LeftHandGripTrans)
         {
             Vector3 correctedGripPosition = ItemEquippableEvents.GetCorrectedGripPosition();
             if (GTFO_VR_Plugin.DEBUG_ENABLED)
             {
                 if (VRConfig.configDebugShowTwoHHitboxes.Value)
                 {
                     DebugDraw3D.DrawSphere(correctedGripPosition, m_doubleHandLeaveDistance, ColorExt.Red(0.1f));
                 }
             }
             return(Vector3.Distance(offhandController.transform.position, ItemEquippableEvents.GetCorrectedGripPosition()) > m_doubleHandLeaveDistance);
         }
     }
     return(Vector3.Distance(mainController.transform.position, offhandController.transform.position) > m_doubleHandLeaveDistance);
 }