コード例 #1
0
 public override void FVRUpdate()
 {
     base.FVRUpdate();
     if (!base.IsHeld && Mathf.Abs(transform.localPosition.z - frontMostPoint.localPosition.z) > 0.001f)
     {
         base.transform.localPosition = new Vector3(base.transform.localPosition.x, base.transform.localPosition.y, Mathf.MoveTowards(transform.localPosition.z, frontMostPoint.localPosition.z, Time.deltaTime * forwardspeed));
     }
     else if (Mathf.Abs(transform.localPosition.z - rearMostPoint.localPosition.z) < 0.01f)
     {
         try { wep.PlayAudioEvent(FirearmAudioEventType.HandleBack); } catch { Console.WriteLine("Forgot to assign FireArmAudioEventType.HandleBack!"); }
         if (!pulled)
         {
             FVRViveHand fakehand = new FVRViveHand();
             fakehand.IsInStreamlinedMode = true;
             fakehand.Input.AXButtonDown  = true;
             wep.UpdateInteraction(fakehand);
             pulled = true;
         }
     }
     else if (Mathf.Abs(transform.localPosition.z - frontMostPoint.localPosition.z) < 0.01f)
     {
         try { wep.PlayAudioEvent(FirearmAudioEventType.HandleForward); } catch { Console.WriteLine("Forgot to assign FireArmAudioEventType.HandleForward!"); }
         pulled = false;
     }
 }
コード例 #2
0
        public override void SimpleInteraction(FVRViveHand hand)
        {
            Firearm.PlayAudioEvent(FirearmAudioEventType.Safety);

            isCutoff = !isCutoff;

            if (isCutoff)
            {
                CutoffSwitch.transform.position = CutoffSwitchTrue.position;
                CutoffSwitch.transform.rotation = CutoffSwitchTrue.rotation;

                CutoffFlag.transform.position = CutoffFlagTrue.position;
                CutoffFlag.transform.rotation = CutoffFlagTrue.rotation;
                Firearm.Magazine = null;
            }
            else
            {
                CutoffSwitch.transform.position = CutoffSwitchFalse.position;
                CutoffSwitch.transform.rotation = CutoffSwitchFalse.rotation;

                CutoffFlag.transform.position = CutoffFlagFalse.position;
                CutoffFlag.transform.rotation = CutoffFlagFalse.rotation;
                Firearm.Magazine = TubeMagazine;
            }
        }
コード例 #3
0
 public static void AccountForPlayerScaleInBothVelWorld(FVRViveHand __instance, ref Vector3 __result)
 {
     if (GM.CurrentPlayerRoot.localScale != Vector3.one)
     {
         __result = new Vector3(__result.x * GM.CurrentPlayerRoot.localScale.x, __result.y * GM.CurrentPlayerRoot.localScale.y, __result.z * GM.CurrentPlayerRoot.localScale.z);
     }
 }
コード例 #4
0
        public GameObject DuplicateFromSpawnLock(FVRViveHand hand)
        {
            //the base keyword does not work for some strange reason, so this is copied from FVRPhysicalObject.DuplicateFromSpawnLock
            GameObject        gameObject = UnityEngine.Object.Instantiate <GameObject>(this.ObjectWrapper.GetGameObject(), this.Transform.position, this.Transform.rotation);
            FVRPhysicalObject fvrObj     = gameObject.GetComponent <FVRPhysicalObject>();

            (fvrObj as FVREntityProxy)?.Data.PrimeDataLists((fvrObj as FVREntityProxy).Flags);
            hand?.ForceSetInteractable(fvrObj);
            fvrObj.SetQuickBeltSlot(null);
            fvrObj.BeginInteraction(hand);

            patch_FVRFireArmClip component = gameObject.GetComponent <patch_FVRFireArmClip>();

            for (int i = 0; i < Mathf.Min(this.LoadedRounds.Length, component.LoadedRounds.Length); i++)
            {
                if (this.LoadedRounds[i] != null && this.LoadedRounds[i].LR_Mesh != null)
                {
                    component.LoadedRounds[i].LR_Class         = this.LoadedRounds[i].LR_Class;
                    component.LoadedRounds[i].LR_Type          = this.LoadedRounds[i].LR_Type;
                    component.LoadedRounds[i].LR_Mesh          = this.LoadedRounds[i].LR_Mesh;
                    component.LoadedRounds[i].LR_Material      = this.LoadedRounds[i].LR_Material;
                    component.LoadedRounds[i].LR_ObjectWrapper = this.LoadedRounds[i].LR_ObjectWrapper;
                }
            }
            component.m_numRounds = this.m_numRounds;
            component.UpdateBulletDisplay();
            return(gameObject);
        }
コード例 #5
0
        private static void CustomizeHand(FVRViveHand fvrhand)
        {
            var hand = fvrhand.transform;

            // Set the idle sphere to our color
            var cfg = _configs.Color;

            fvrhand.TouchSphereMat_NoInteractable.SetColor(COLOR_PROPERTY, Recolor(cfg.InteractSphere, cfg.Intensity.Value));

            // Resize interaction spheres & colliders
            var scale = new float[] { _configs.FingerSize.Value, _configs.PalmSize.Value };

            SphereCollider[] collider = hand.GetComponents <SphereCollider>();
            Transform[]      vis      = new Transform[]
            {
                fvrhand.TouchSphere.transform,
                fvrhand.TouchSphere_Palm.transform
            };
            for (var i = 0; i < vis.Length; i++)
            {
                collider[i].radius = collider[i].radius * scale[i];

                var visScale = vis[i].localScale.x * scale[i];
                vis[i].localScale = new Vector3(visScale, visScale, visScale);
            }

            ColorHandRecursive(Plugin.GetControllerFrom(fvrhand));
        }
コード例 #6
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            if (hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.25f)
            {
                Vector2 touchpadAxes = hand.Input.TouchpadAxes;

                if (DisplayCam != null)
                {
                    if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
                    {
                        ToggleCameraState();
                    }

                    if (CameraOn && (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f))
                    {
                        int direction = (int)Mathf.Sign(touchpadAxes.x) * 10;
                        DisplayCam.fieldOfView = Mathf.Clamp(DisplayCam.fieldOfView + direction, 20, 80);
                        if (FOVChange.Clips.Count > 0)
                        {
                            SM.PlayCoreSound(FVRPooledAudioType.UIChirp, FOVChange, this.transform.position);
                        }
                    }
                }
            }
        }
コード例 #7
0
        public void dropmag(FVRViveHand hand, bool _override = false)
        {
            if (DisallowEjection && !_override)
            {
                return;
            }
            FVRFireArmMagazine magazine = null;

            if (WepType == 1)
            {
                magazine = this.ClosedBoltReceiver.Magazine;
                this.ClosedBoltReceiver.ReleaseMag();
            }
            if (WepType == 2)
            {
                magazine = this.OpenBoltWeapon.Magazine;
                this.OpenBoltWeapon.ReleaseMag();
            }
            if (WepType == 3)
            {
                magazine = this.HandgunReceiver.Magazine;
                this.HandgunReceiver.ReleaseMag();
            }
            movemagtohand(hand, magazine);
        }
コード例 #8
0
 public static bool IfPressedInDir(FVRViveHand hand, Vector2 dir)
 {
     if (Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.2f)
     {
         return(true);
     }
     return(false);
 }
コード例 #9
0
 public override void SimpleInteraction(FVRViveHand hand)
 {
     base.SimpleInteraction(hand);
     if (TouchpadDir == TouchpadDirType.Trigger)
     {
         dropmag(hand);
     }
 }
コード例 #10
0
 public override void SimpleInteraction(FVRViveHand hand)
 {
     if (IsSimpleInteract == false)
     {
         return;
     }
     ReleaseBolt(hand);
 }
コード例 #11
0
 public override void UpdateInteraction(FVRViveHand hand)
 {
     base.UpdateInteraction(hand);
     foreach (FVRInteractiveObject obj in InteractiveObjects)
     {
         obj.UpdateInteraction(hand);
     }
 }
コード例 #12
0
 public void movemagtohand(FVRViveHand hand, FVRFireArmMagazine magazine)
 {
     //puts mag in hand
     if (hand != null)
     {
         hand.ForceSetInteractable(magazine);
     }
     magazine.BeginInteraction(hand);
 }
コード例 #13
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);
            Vector3 closestValidPoint = base.GetClosestValidPoint(this.frontMostPoint.position, this.rearMostPoint.position, this.m_hand.Input.Pos);

            base.transform.position = closestValidPoint;
            float m_currentHandleZ = transform.localPosition.z;
            float l = Mathf.InverseLerp(frontMostPoint.localPosition.z, rearMostPoint.localPosition.z, transform.localPosition.z);
        }
コード例 #14
0
 public override void UpdateInteraction(FVRViveHand hand)
 {
     try
     {
         base.UpdateInteraction(hand);
     }
     catch
     {
     }
 }
コード例 #15
0
 protected void OnHoverStay(FVRViveHand hand)
 {
     if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Trigger && !hand.IsInStreamlinedMode)
     {
         return;
     }
     if (hand.IsInStreamlinedMode && !hand.Input.AXButtonPressed)
     {
         return;
     }
     ReleaseBolt(hand);
 }
コード例 #16
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            bool flag = false;
            FVRFireArmMagazine prevmag = null;

            if (mag != null)
            {
                flag = true; prevmag = mag;
            }                                                            //check if mag was previously loaded

            if (WepType == 1)
            {
                mag = this.ClosedBoltReceiver.Magazine;
            }
            if (WepType == 2)
            {
                mag = this.OpenBoltWeapon.Magazine;
            }
            if (WepType == 3)
            {
                mag = this.HandgunReceiver.Magazine;
            }

            if (mag != null)
            {
                bool flag2 = false;
                if (Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.2f)
                {
                    flag2 = true;
                }

                if (flag2 || !PressDownToRelease || hand.IsInStreamlinedMode && hand.Input.AXButtonPressed)
                {
                    if (TouchpadDir == TouchpadDirType.NoDirection)
                    {
                        return;
                    }
                    dropmag(hand);
                    this.EndInteraction(hand);
                }
            }
            else
            {
                if (flag)                 //if mag was previously loaded, but is now not
                {
                    movemagtohand(hand, prevmag);
                }
                this.EndInteraction(hand);
            }
        }
コード例 #17
0
        public static string H3InfoPrint(H3Info options)
        {
            string ret = "";

            //0b00101111

            if (options.HasFlag(H3Info.FPS))
            {
                ret += $"\n{Time.timeScale / Time.smoothDeltaTime:F0} FPS ({(1f / Time.timeScale) * Time.deltaTime * 1000:F2}ms) ({Time.timeScale}x)";
            }
            if (options.HasFlag(H3Info.DateTime))
            {
                ret += "\n" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            }
            if (options.HasFlag(H3Info.Position))
            {
                ret += $"\nPosition: {GM.CurrentPlayerRoot.position}";
            }
            if (options.HasFlag(H3Info.Health))
            {
                ret += $"\nHealth: {GM.CurrentPlayerBody.GetPlayerHealthRaw()}/{GM.CurrentPlayerBody.GetMaxHealthPlayerRaw()} ({(GM.CurrentPlayerBody.GetPlayerHealth() * 100):F0}%)";
            }
            if (options.HasFlag(H3Info.Scene))
            {
                ret += $"\nScene: {UnityEngine.SceneManagement.SceneManager.GetActiveScene().name} - level{UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex}";
            }
            if (options.HasFlag(H3Info.SAUCE))
            {
                ret += $"\n{GM.Omni.OmniUnlocks.SaucePackets} S.A.U.C.E.";
            }
            if (options.HasFlag(H3Info.Headset))
            {
                ret += $"\nHeadset: {VRDevice.model}";
            }
            if (options.HasFlag(H3Info.ControllerL))
            {
                FVRViveHand left = GM.CurrentPlayerBody.LeftHand.GetComponent <FVRViveHand>();
                ret += $"\n Left Controller: {H3InfoPrint_Controllers(left.Pose[left.HandSource].trackedDeviceIndex)}";
            }
            if (options.HasFlag(H3Info.ControllerR))
            {
                FVRViveHand right = GM.CurrentPlayerBody.RightHand.GetComponent <FVRViveHand>();
                ret += $"\nRight Controller: {H3InfoPrint_Controllers(right.Pose[right.HandSource].trackedDeviceIndex)}";
            }

            if (ret[0] == '\n')
            {
                ret = ret.Substring(1);
            }

            return(ret);
        }
コード例 #18
0
        public void ReleaseBolt(FVRViveHand hand, bool _forceDrop = false)
        {
            var flag2 = Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.2f;

            if (flag2 || hand.IsInStreamlinedMode && hand.Input.AXButtonPressed)
            {
                this.ClosedBoltReceiver.Bolt.ReleaseBolt();
            }

            if (this.ClosedBoltReceiver.m_hand == null || hand != this.ClosedBoltReceiver.m_hand)
            {
            }
        }
コード例 #19
0
 public override void SimpleInteraction(FVRViveHand hand)
 {
     base.SimpleInteraction(hand);
     ChangePosition(ChangePositionType.Swap);
     try
     {
         wep.PlayAudioEvent(FirearmAudioEventType.BreachOpen);
     }
     catch
     {
         Console.WriteLine("SelbstladerUnlockSystem.cs failed to play the BreachOpen sound!");
     }
 }
コード例 #20
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            // If we're already completely eaten return
            if (_currentStage == EatStages.Length)
            {
                return;
            }

            // Check if we're close enough to be eaten
            if (Vector3.Distance(transform.position, GM.CurrentPlayerBody.Head.transform.position + GM.CurrentPlayerBody.Head.transform.up * -0.2f) >= 0.150000005960464)
            {
                return;
            }

            // Check if it's been long enough since the last time we were eaten
            if (_lastEatTime + EatDelay > Time.time)
            {
                return;
            }

            // Play the eat sound
            _lastEatTime = Time.time;
            SM.PlayGenericSound(EatSound, transform.position);
            EatEvent.Invoke();
            GM.CurrentPlayerBody.HealPercent(HealPercent);
            if (_currentStage != EatStages.Length - 1 || DestroyOnEat)
            {
                EatStages[_currentStage].SetActive(false);
            }
            _currentStage++;

            // If we've eaten all the stages
            if (_currentStage == EatStages.Length && DestroyOnEat)
            {
                EndInteraction(hand);
                hand.ForceSetInteractable(null);
                Destroy(gameObject);
            }
            else
            {
                EatStages[_currentStage].SetActive(true);
            }
        }
コード例 #21
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            if (hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.25f && MeatTrak != null)
            {
                Vector2 touchpadAxes = hand.Input.TouchpadAxes;

                if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f)
                {
                    if (m_waitingForConfirmation)
                    {
                        MeatTrak.NumberTarget = 0;

                        if (Aud_ClearComplete.Clips.Count > 0)
                        {
                            SM.PlayCoreSound(FVRPooledAudioType.UIChirp, Aud_ClearComplete, this.transform.position);
                        }
                    }
                    else
                    {
                        if (Aud_ClearRequestConfirmation.Clips.Count > 0)
                        {
                            SM.PlayCoreSound(FVRPooledAudioType.UIChirp, Aud_ClearRequestConfirmation, this.transform.position);
                        }
                    }

                    m_waitingForConfirmation = !m_waitingForConfirmation;
                }

                if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f)
                {
                    int direction = (int)Mathf.Sign(touchpadAxes.x);
                    TrackingMode = (TrackingModes)Mathf.Repeat((float)TrackingMode + direction, ModeSprites.Length);

                    UpdateMode();

                    if (Aud_ModeSwitch.Clips.Count > 0)
                    {
                        SM.PlayCoreSound(FVRPooledAudioType.UIChirp, Aud_ModeSwitch, this.transform.position);
                    }
                }
            }
        }
コード例 #22
0
ファイル: Patches.cs プロジェクト: WurstModders/WurstMod
        static bool Prefix(MainMenuScenePointable __instance, FVRViveHand hand)
        {
            if (hand.Input.TriggerDown)
            {
                if (__instance.name == "MODDEDSCREEN")
                {
                    var levelId = __instance.Def.Name.Split('\n')[1];
                    var level   = CustomLevelFinder.EnumerateLevelInfos().FirstOrDefault(x => x.Identifier == levelId);
                    Loader.LevelToLoad = level;
                }
                else
                {
                    Loader.LevelToLoad = null;
                }
            }


            return(true);
        }
コード例 #23
0
 public override void SimpleInteraction(FVRViveHand hand)
 {
     base.SimpleInteraction(hand);
     this.m_isLargeAperture = !this.m_isLargeAperture;
     try
     {
         if (!m_isLargeAperture)
         {
             SM.PlayGenericSound(AudClipOpen, transform.position);
         }
         else
         {
             SM.PlayGenericSound(AudClipClose, transform.position);
         }
     }
     catch
     {
         Console.WriteLine(this.name + " failed to play sound!");
     }
 }
コード例 #24
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            if (hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.25f)
            {
                Vector2 touchpadAxes = hand.Input.TouchpadAxes;

                if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
                {
                    ToggleKinematicLocked();
                    if (KinematicToggle.Clips.Count > 0)
                    {
                        SM.PlayCoreSound(FVRPooledAudioType.UIChirp, KinematicToggle, this.transform.position);
                    }
                }

                if (DisplayCam != null && RenderTargetCam != null)
                {
                    if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
                    {
                        ToggleCameraState();
                        if (Screen != null)
                        {
                            Screen.TargetRotation = new Vector3(0f, CameraOn ? 0f : -90f, 0f);
                        }
                    }

                    if (CameraOn && (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f))
                    {
                        int direction = (int)Mathf.Sign(touchpadAxes.x) * 10;
                        DisplayCam.fieldOfView      = Mathf.Clamp(DisplayCam.fieldOfView + direction, 20, 80);
                        RenderTargetCam.fieldOfView = DisplayCam.fieldOfView;
                        if (FOVChange.Clips.Count > 0)
                        {
                            SM.PlayCoreSound(FVRPooledAudioType.UIChirp, FOVChange, this.transform.position);
                        }
                    }
                }
            }
        }
コード例 #25
0
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            if (IfPressedInDir(hand, Vector2.up))
            {
                selectedtxt++;
            }
            if (IfPressedInDir(hand, Vector2.left))
            {
            }
            int val = 1;

            if (enableMagnificationSettings)
            {
                val++;
            }
            if (selectedtxt > val)
            {
                selectedtxt = 0;
            }
        }
コード例 #26
0
ファイル: ModPanelV2.cs プロジェクト: TylerS76/LSIIC
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);

            if (hand.Input.TouchpadDown && hand.Input.TouchpadAxes.magnitude > 0.25f)
            {
                Vector2 touchpadAxes = hand.Input.TouchpadAxes;

                if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f)
                {
                    PrevPage();
                }
                else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f)
                {
                    NextPage();
                }

                if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
                {
                    ToggleKinematicLocked();
                }
            }
        }
コード例 #27
0
 /// <summary>
 /// Called to update the objects interaction with a vive controller
 /// </summary>
 /// <param name="hand">The hand interacting</param>
 public override void UpdateInteraction(FVRViveHand hand)
 {
     base.UpdateInteraction(hand);
     //Check if the touchpad is clicked
     if (hand.Input.TouchpadDown)
     {
         var touchpadAxes = hand.Input.TouchpadAxes;
         //Only do checks if the user actually ment to click
         if (touchpadAxes.magnitude > 0.2f)
         {
             if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
             {
                 //Up on touchpad
                 InjectionMethods.CurrentManagerWrapper.CurrentManager.GetComponent <AudioModComponent>().IncreaseMusicVolume();
             }
             else if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
             {
                 //Down on touchpad
                 InjectionMethods.CurrentManagerWrapper.CurrentManager.GetComponent <AudioModComponent>().DecreaseMusicVolume();
             }
             else if (Vector2.Angle(touchpadAxes, Vector2.right) <= 45f)
             {
                 //Right on touchpad
                 //Get AudioMod component and skip song
                 if (InjectionMethods.CurrentManagerWrapper.GetState() == ManagerWrapper.State.Taking)
                 {
                     InjectionMethods.CurrentManagerWrapper.CurrentManager.GetComponent <AudioModComponent>().SkipTakeMusic();
                 }
                 else
                 {
                     InjectionMethods.CurrentManagerWrapper.CurrentManager.GetComponent <AudioModComponent>().SkipHoldMusic();
                 }
             }
         }
     }
 }
コード例 #28
0
ファイル: Plugin.cs プロジェクト: lronB/BetterHands
        // Return the gameobject geo we are using
        public static GameObject GetControllerFrom(FVRViveHand hand)
        {
            var controllerGeos = new GameObject[]
            {
                hand.Display_Controller_Cosmos,
                hand.Display_Controller_HPR2,
                hand.Display_Controller_Index,
                hand.Display_Controller_Quest2,
                hand.Display_Controller_RiftS,
                hand.Display_Controller_Touch,
                hand.Display_Controller_Vive,
                hand.Display_Controller_WMR
            };

            foreach (var geo in controllerGeos)
            {
                if (geo.activeSelf)
                {
                    return(geo);
                }
            }

            return(hand.Display_Controller);
        }
コード例 #29
0
        // Token: 0x06003437 RID: 13367 RVA: 0x0016D210 File Offset: 0x0016B610
        public override void UpdateInteraction(FVRViveHand hand)
        {
            base.UpdateInteraction(hand);
            var num       = 0f;
            var hingeAxis = this.hingeAxis;

            if (hingeAxis != Axis.X)
            {
                if (hingeAxis != Axis.Y)
                {
                    if (hingeAxis == Axis.Z)
                    {
                        num = transform.InverseTransformDirection(hand.Input.VelAngularWorld).z;
                    }
                }
                else
                {
                    num = transform.InverseTransformDirection(hand.Input.VelAngularWorld).y;
                }
            }
            else
            {
                num = transform.InverseTransformDirection(hand.Input.VelAngularWorld).x;
            }
            if (num > 15f && canUnlatch)
            {
                Unlatch();
            }
            else if (num < -15f && canUnlatch)
            {
                Latch();
            }
            if (hand.Input.TouchpadDown && !IsAltHeld)
            {
                var touchpadAxes = hand.Input.TouchpadAxes;
                if (touchpadAxes.magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) < 45f && canCockHammer)
                {
                    CockHammer();
                }
                else if (touchpadAxes.magnitude > 0.2f && (Vector2.Angle(touchpadAxes, Vector2.left) < 45f || Vector2.Angle(touchpadAxes, Vector2.right) < 45f) && canUnlatch)
                {
                    ToggleLatchState();
                }
            }
            if (_mIsDestroyed)
            {
                return;
            }
            if (m_hasTriggeredUpSinceBegin && !IsAltHeld)
            {
                _triggerFloat = hand.Input.TriggerFloat;
            }
            else
            {
                _triggerFloat = 0f;
            }
            var x = Mathf.Lerp(triggerForwardBackRots.x, triggerForwardBackRots.y, _triggerFloat);

            trigger.localEulerAngles = new Vector3(x, 0f, 0f);
            if (_triggerFloat > 0.7f)
            {
                if (_mIsTriggerReset && _mIsHammerCocked)
                {
                    _mIsTriggerReset = false;
                    _mIsHammerCocked = false;
                    if (hammer != null)
                    {
                        SetAnimatedComponent(hammer, hammerMinRot, hammerInterp, hammerAxis);
                    }
                    PlayAudioEvent(FirearmAudioEventType.HammerHit, 1f);
                    Fire();
                }
            }
            else if (_triggerFloat < 0.2f && !_mIsTriggerReset)
            {
                _mIsTriggerReset = true;
            }
        }
コード例 #30
0
        public static void UpdateTimeScaleText(FVRWristMenu __instance, bool ___m_isActive, bool ___m_hasHands, FVRViveHand ___m_currentHand)
        {
            if (___m_isActive)
            {
                if (__instance.Clock.alignment != TextAnchor.LowerCenter)
                {
                    __instance.Clock.rectTransform.anchoredPosition = new Vector2(0f, 7.8f);
                    __instance.Clock.alignment = TextAnchor.LowerCenter;
                }

                Helpers.H3Info info = Helpers.H3Info.FPS | Helpers.H3Info.DateTime | Helpers.H3Info.Position | Helpers.H3Info.Health | Helpers.H3Info.Scene;
                if (___m_hasHands)
                {
                    info |= ___m_currentHand.IsThisTheRightHand ? Helpers.H3Info.ControllerR : Helpers.H3Info.ControllerL;
                }
                __instance.Clock.text = Helpers.H3InfoPrint(info) + "\nH3 Enhanced Wrist Menu";
            }
        }