//-------------------------------------------------
        private void ShowText(ISteamVR_Action_In_Source action, string text, bool highlightButton = true)
        {
            if (actionHintInfos.ContainsKey(action))
            {
                ActionHintInfo hintInfo = actionHintInfos[action];
                hintInfo.textHintObject.SetActive(true);
                hintInfo.textHintActive = true;

                if (hintInfo.text != null)
                {
                    hintInfo.text.text = text;
                }

                if (hintInfo.textMesh != null)
                {
                    hintInfo.textMesh.text = text;
                }

                UpdateTextHint(hintInfo);

                if (highlightButton)
                {
                    ShowButtonHint(action);
                }

                renderModel.gameObject.SetActive(true);
            }
        }
Exemple #2
0
        private void ActionHvThrustChange(ISteamVR_Action_In_Source vectorAction,
                                          SteamVR_Input_Sources inputSource, Vector2 axis, Vector2 delta)
        {
//            Debug.Log($"HV Thrust inputSource:{vectorAction.activeDevice} X:{axis.x} Y:{axis.y}");
            output.SetAxisY(axis.y, -1f, 1f);
            output.SetAxisX(axis.x, -1f, 1f);
        }
        //-------------------------------------------------
        public static void ShowTextHint(Hand hand, ISteamVR_Action_In_Source action, string text, bool highlightButton = true)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                hints.ShowText(action, text, highlightButton);
            }
        }
        //-------------------------------------------------
        public static void HideTextHint(Hand hand, ISteamVR_Action_In_Source action)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                hints.HideText(action);
            }
        }
        //-------------------------------------------------
        private void HideText(ISteamVR_Action_In_Source action)
        {
            if (actionHintInfos.ContainsKey(action))
            {
                ActionHintInfo hintInfo = actionHintInfos[action];
                hintInfo.textHintObject.SetActive(false);
                hintInfo.textHintActive = false;

                HideButtonHint(action);
            }
        }
        //-------------------------------------------------
        public static bool IsButtonHintActive(Hand hand, ISteamVR_Action_In_Source action)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                return(hints.IsButtonHintActive(action));
            }

            return(false);
        }
        //-------------------------------------------------
        public static string GetActiveHintText(Hand hand, ISteamVR_Action_In_Source action)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                return(hints.GetActiveHintText(action));
            }

            return(string.Empty);
        }
Exemple #8
0
 private void ActionGripRightChange(ISteamVR_Action_In_Source booleanAction,
                                    SteamVR_Input_Sources inputSource, float axis, float delta)
 {
     if (axis > 0.8f)
     {
         joy.gripped = true;
     }
     else if (axis < 0.2f)
     {
         joy.gripped = false;
     }
 }
 //-------------------------------------------------
 private string GetActiveHintText(ISteamVR_Action_In_Source action)
 {
     if (actionHintInfos.ContainsKey(action))
     {
         ActionHintInfo hintInfo = actionHintInfos[action];
         if (hintInfo.textHintActive)
         {
             return(hintInfo.text.text);
         }
     }
     return(string.Empty);
 }
Exemple #10
0
        //-------------------------------------------------
        public static void HideTextHint(BNG.Grabber hand, ISteamVR_Action_In_Source action)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                hints.HideText(action);

                //if (hand != null)
                //{
                //    if (hints.autoSetWithControllerRangeOfMotion)
                //        hand.ResetTemporarySkeletonRangeOfMotion();
                //}
            }
        }
Exemple #11
0
        //-------------------------------------------------
        public static void ShowTextHint(BNG.Grabber hand, ISteamVR_Action_In_Source action, string text, bool highlightButton = true)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                hints.ShowText(action, text, highlightButton);

                //if (hand != null)
                //{
                //    if (hints.autoSetWithControllerRangeOfMotion)
                //        hand.SetTemporarySkeletonRangeOfMotion(SkeletalMotionRangeChange.WithController);
                //}
            }
        }
        //-------------------------------------------------
        private bool IsButtonHintActive(ISteamVR_Action_In_Source action)
        {
            if (actionHintInfos.ContainsKey(action))
            {
                ActionHintInfo hintInfo = actionHintInfos[action];
                foreach (MeshRenderer buttonRenderer in hintInfo.renderers)
                {
                    if (flashingRenderers.Contains(buttonRenderer))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        //-------------------------------------------------
        public static void ShowTextHint(Hand hand, ISteamVR_Action_In_Source action, string text, bool highlightButton = true)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                if (hand != null && !hints.actionHintInfos[action].textHintActive)
                {
                    hand.hintsActive++;
                    if (!hand.isControllerActive && hand.hintsActive == 1)
                    {
                        hand.SetTemporarySkeletonRangeOfMotion(SkeletalMotionRangeChange.WithController);
                    }
                }
                hints.ShowText(action, text, !hand.isControllerActive, highlightButton);
            }
        }
        //-------------------------------------------------
        public static void HideTextHint(Hand hand, ISteamVR_Action_In_Source action)
        {
            ControllerButtonHints hints = GetControllerButtonHints(hand);

            if (hints != null)
            {
                hints.HideText(action);
                if (hand != null)
                {
                    hand.hintsActive--;
                    if (hand.hintsActive == 0)
                    {
                        if (!hand.isControllerActive)
                        {
                            hand.ResetTemporarySkeletonRangeOfMotion();
                        }
                        hints.renderModel.gameObject.SetActive(false);
                    }
                }
            }
        }
        //-------------------------------------------------
        private void ShowText(ISteamVR_Action_In_Source action, string text, bool rendering, bool highlightButton = true)
        {
            if (actionHintInfos.ContainsKey(action))
            {
                ActionHintInfo hintInfo = actionHintInfos[action];
                hintInfo.textHintObject.SetActive(true);
                hintInfo.textHintActive = true;

                if (hintInfo.text != null)
                {
                    hintInfo.text.text = text;
                }

                if (hintInfo.textMesh != null)
                {
                    hintInfo.textMesh.text = text;
                }

                UpdateTextHint(hintInfo);

                if (highlightButton)
                {
                    ShowButtonHint(action);
                }
                renderModel.gameObject.SetActive(true);
                Color color;
                if (rendering)
                {
                    color = new Color(1, 1, 1, 0.125f);
                }
                else
                {
                    color = new Color(1, 1, 1, 0);
                }
                controllerMaterial.color = color;
            }
        }
Exemple #16
0
        private void ActionGrabJoystickChange(ISteamVR_Action_In_Source booleanAction,
                                              SteamVR_Input_Sources inputSource, bool activeBinding)
        {
//            Debug.Log($"Grab Joystick inputSource:{booleanAction.activeDevice} {activeBinding}");
            joy.gripped = activeBinding;
        }
 public ActionHandPair(ISteamVR_Action_In_Source action, SteamVR_Input_Sources hand)
 {
     this.action = action;
     this.hand   = hand;
 }
Exemple #18
0
 //-------------------------------------------------
 private void ShowText(ISteamVR_Action_In_Source action, string text, bool highlightButton = true)
 {
 }
Exemple #19
0
        private void ActionForwardThrustChange(ISteamVR_Action_In_Source singleAction,
                                               SteamVR_Input_Sources inputSource, float axis, float delta)
        {
//            Debug.Log($"Forward Thrust inputSource:{singleAction.activeDevice} {axis}");
            output.SetAxisZ(axis, 0f, 1f);
        }
Exemple #20
0
        private void ActionUiBackChange(ISteamVR_Action_In_Source booleanAction,
                                        SteamVR_Input_Sources inputSource, bool activeBinding)
        {
//            Debug.Log($"UI Back inputSource:{booleanAction.activeDevice} {activeBinding}");
            output.SetButton((uint)ActionMappings.UiBack, activeBinding);
        }
Exemple #21
0
 private void ActionPitchRollChange(ISteamVR_Action_In_Source vectorAction,
                                    SteamVR_Input_Sources inputSource, Vector2 axis, Vector2 delta)
 {
     output.SetAxisXRot(axis.y, -1f, 1f);
     output.SetAxisYRot(axis.x, -1f, 1f);
 }