private void DisableHint() { foreach (Hand hand in player.hands) { if (hand.noSteamVRFallbackCamera == null) { ControllerButtonHints.HideTextHint(hand, actionToPrompt); } } }
private void OnTriggerEnter(Collider other) { if (other.GetComponent <Grabber>()) { Debug.LogError("Trigger grabber"); currentHand = other.GetComponent <Grabber>(); ControllerButtonHints.ShowButtonHint(currentHand, testction); } }
IEnumerator ActivateToolTips() { yield return(null); ControllerButtonHints.ShowButtonHint(Player.instance.leftHand, videoSkipAction); ControllerButtonHints.ShowTextHint(Player.instance.leftHand, videoSkipAction, "<<"); ControllerButtonHints.ShowButtonHint(Player.instance.rightHand, videoSkipAction); ControllerButtonHints.ShowTextHint(Player.instance.rightHand, videoSkipAction, ">>"); }
public async void ShowHints(float seconds) { var rightHand = globalObjectService.VrRightHand.GetComponentInChildren <Hand>(); var leftHand = globalObjectService.VrLeftHand.GetComponentInChildren <Hand>(); ControllerButtonHints.ShowTextHint(rightHand, SteamVR_Actions.default_GrabGrip, "Hold and move up and down"); ControllerButtonHints.ShowTextHint(leftHand, SteamVR_Actions.default_GrabGrip, "Hold and move up and down"); await coroutineService.WaitSeconds(seconds); HideHints(); }
private void OnEnable() { foreach (Hand hand in player.hands) { if (hand.noSteamVRFallbackCamera == null) { ControllerButtonHints.ShowTextHint(hand, actionToPrompt, textToPrompt); Invoke("DisableHint", timeToPrompt); } } }
private void HideAllButtonHints() { foreach (Hand hand in Player.instance.hands) { if (disableAllButtonHints) { ControllerButtonHints.HideAllButtonHints(hand); ControllerButtonHints.HideAllTextHints(hand); } } }
private void HandHoverUpdate(Hand hand) { if (hand.GetStandardInteractionButtonDown()) { rb.isKinematic = true; rb.useGravity = false; ownCollider.isTrigger = true; hand.AttachObject(gameObject, attachmentFlags, attachmentPoint); ControllerButtonHints.HideTextHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); } }
//------------------------------------------------- public void DisableHint() { if (btnAndTxtHintCoroutine != null) { ControllerButtonHints.HideTextHint(player.rightHand, action); StopCoroutine(btnAndTxtHintCoroutine); btnAndTxtHintCoroutine = null; } CancelInvoke("ShowHint"); }
//------------------------------------------------- private void OnHandHoverEnd(Hand hand) { ControllerButtonHints.HideButtonHint(hand, EVRButtonId.k_EButton_SteamVR_Trigger); if (driving && hand.GetStandardInteractionButton()) { StartCoroutine(HapticPulses(hand.controller, 1.0f, 10)); } driving = false; handHoverLocked = null; }
//------------------------------------------------- private IEnumerator TeleportHintCoroutine() { float prevBreakTime = Time.time; float prevHapticPulseTime = Time.time; while (true) { bool pulsed = false; //Show the hint on each eligible hand foreach (Hand hand in player.hands) { bool showHint = IsEligibleForTeleport(hand); bool isShowingHint = !string.IsNullOrEmpty(ControllerButtonHints.GetActiveHintText(hand, EVRButtonId.k_EButton_SteamVR_Touchpad)); if (showHint) { if (!isShowingHint) { ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad, "Teleport"); prevBreakTime = Time.time; prevHapticPulseTime = Time.time; } if (Time.time > prevHapticPulseTime + 0.05f) { //Haptic pulse for a few seconds pulsed = true; hand.controller.TriggerHapticPulse(500); } } else if (!showHint && isShowingHint) { ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad); } } if (Time.time > prevBreakTime + 3.0f) { //Take a break for a few seconds yield return(new WaitForSeconds(3.0f)); prevBreakTime = Time.time; } if (pulsed) { prevHapticPulseTime = Time.time; } yield return(null); } }
private IEnumerator TeleportHintCoroutine() { float prevBreakTime = Time.time; float prevHapticPulseTime = Time.time; while (m_IsEnter && m_FisrtEnter) { Hand hand = GameManager.Instance.GetHand(); bool pulsed = false; //Show the hint on each eligible hand if (moveAction.GetAxis(hand.handType) == Vector2.zero) { bool isShowingHint = !string.IsNullOrEmpty(ControllerButtonHints.GetActiveHintText(hand, moveAction)); if (!isShowingHint) { HideTextHint(); ControllerButtonHints.ShowTextHint(hand, moveAction, "滚动滑轮切换图片"); prevBreakTime = Time.time; prevHapticPulseTime = Time.time; } if (Time.time > prevHapticPulseTime + 0.05f) { //Haptic pulse for a few seconds pulsed = true; hand.TriggerHapticPulse(500); } } else { m_FisrtEnter = false; HideTextHint(); } if (Time.time > prevBreakTime + 3.0f) { //Take a break for a few seconds yield return(new WaitForSeconds(3.0f)); prevBreakTime = Time.time; } if (pulsed) { prevHapticPulseTime = Time.time; } yield return(null); } }
//------------------------------------------------- public void DisableHint() { Debug.Log("Disable Hints is invoked"); if (btnAndTxtHintCoroutine != null) { ControllerButtonHints.HideTextHint(player.leftHand, action); StopCoroutine(btnAndTxtHintCoroutine); btnAndTxtHintCoroutine = null; } CancelInvoke("ShowHint"); }
// Update is called once per frame void Update() { if (isTeleportHintOn) { ControllerButtonHints.ShowButtonHint(leftHand, teleportActionInput); ControllerButtonHints.ShowButtonHint(rightHand, teleportActionInput); ControllerButtonHints.ShowTextHint(leftHand, teleportActionInput, teleportHintString); ControllerButtonHints.ShowTextHint(rightHand, teleportActionInput, teleportHintString); isTeleportHintOn = false; } else if (isGripHintOn) { ControllerButtonHints.ShowButtonHint(leftHand, gripActionInput); ControllerButtonHints.ShowButtonHint(rightHand, gripActionInput); ControllerButtonHints.ShowTextHint(leftHand, gripActionInput, gripHintString); ControllerButtonHints.ShowTextHint(rightHand, gripActionInput, gripHintString); isGripHintOn = false; } else if (isMenuHintOn) { ControllerButtonHints.ShowButtonHint(leftHand, menuActionInput); ControllerButtonHints.ShowButtonHint(rightHand, menuActionInput); ControllerButtonHints.ShowTextHint(leftHand, menuActionInput, menuHintString); ControllerButtonHints.ShowTextHint(rightHand, menuActionInput, menuHintString); isMenuHintOn = false; } else if (isPinchHintOn) { ControllerButtonHints.ShowButtonHint(leftHand, isPinchActionInput); ControllerButtonHints.ShowButtonHint(rightHand, isPinchActionInput); ControllerButtonHints.ShowTextHint(leftHand, isPinchActionInput, pinchHintString); ControllerButtonHints.ShowTextHint(rightHand, isPinchActionInput, pinchHintString); isPinchHintOn = false; } if (turnOffAllHints) { ControllerButtonHints.HideAllButtonHints(leftHand); ControllerButtonHints.HideAllButtonHints(rightHand); ControllerButtonHints.HideAllTextHints(leftHand); ControllerButtonHints.HideAllTextHints(rightHand); turnOffAllHints = false; } }
private void OnHandHoverBegin(Hand hand) { var statInfo = door.GetCurrentAnimatorStateInfo(0); if (statInfo.IsName("glass_door_closed")) { ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_SteamVR_Trigger, "开门"); } else if (statInfo.IsName("glass_door_opened")) { ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_SteamVR_Trigger, "关门"); } Debug.Log(Teleport.instance); Teleport.instance.gameObject.SetActive(false); }
//------------------------------------------------- public void CancelTeleportHint() { if (hintCoroutine != null) { foreach (Hand hand in player.hands) { ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad); } StopCoroutine(hintCoroutine); hintCoroutine = null; } CancelInvoke("ShowTeleportHint"); }
// Update is called once per frame. void Update() { try { if (!ControllerButtonHints.IsButtonHintActive(Player.instance.rightHand, select)) { ControllerButtonHints.ShowTextHint(Player.instance.rightHand, select, "Select Robot"); } } catch (System.Exception e) { Debug.Log(e.Message); } }
public void TriggerDown(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource) { if (interactable.attachedToHand == null) { return; } if (shownChangeToolHint && !shownDrawHint) { shownDrawHint = true; ControllerButtonHints.HideButtonHint(interactable.attachedToHand, m_DrawAction); ControllerButtonHints.HideTextHint(interactable.attachedToHand, m_DrawAction); } StartDraw(); }
public void ShowInStage() { tutorialText.text = currTexts[stageIndex]; audioSource.Stop(); audioSource.PlayOneShot(currClips[stageIndex]); foreach (Hand hand in hands) { ControllerButtonHints.HideAllButtonHints(hand); if (currButtons[stageIndex] != Button.None) { ControllerButtonHints.ShowButtonHint(hand, (EVRButtonId)currButtons[stageIndex]); } } }
private IEnumerator widthHintCoroutine() { float prevBreakTime = Time.time; float prevHapticPulseTime = Time.time; while (true) { bool pulsed = false; //Show the hint on each eligible hand foreach (Hand hand in player.hands) { bool isShowingHint = !string.IsNullOrEmpty(ControllerButtonHints.GetActiveHintText(hand, SteamVR_Actions._default.decreaseWidth)); if (isShowingHint == false) { ControllerButtonHints.ShowTextHint(hand, SteamVR_Actions._default.decreaseWidth, "Press sides to adjust brush width"); prevBreakTime = Time.time; prevHapticPulseTime = Time.time; } if (Time.time > prevHapticPulseTime + 0.05f) { //Haptic pulse for a few seconds pulsed = true; hand.TriggerHapticPulse(500); } } if (Time.time > prevBreakTime + 3.0f) { //Take a break for a few seconds yield return(new WaitForSeconds(3.0f)); prevBreakTime = Time.time; } if (pulsed) { prevHapticPulseTime = Time.time; } yield return(null); } }
public void OnAttachedToHand(Hand hand) { this.hand = hand; ControllerButtonHints.ShowTextHint(hand, teleportAction, "Play/Pause"); IEnumerator HideHintAfterTimer(float time) { yield return(new WaitForSeconds(time)); if (this.hand != null) { ControllerButtonHints.HideAllTextHints(hand); } } StartCoroutine(HideHintAfterTimer(5)); }
/// <summary> /// Activates all the controller hints /// </summary> private void GenerateHints() { foreach (Hand hand in Player.instance.hands) { ControllerButtonHints.HideAllTextHints(hand); for (int actionIndex = 0; actionIndex < SteamVR_Input.actionsIn.Length; actionIndex++) { ISteamVR_Action_In action = SteamVR_Input.actionsIn[actionIndex]; if (action.GetActive(hand.handType)) { ControllerButtonHints.ShowButtonHint(hand, action); ControllerButtonHints.ShowTextHint(hand, action, action.GetShortName()); } } } hintsOn = true; }
//------------------------------------------------- private void OnHandHoverBegin(Hand hand) { bool showHint = false; // "Catch" the throwable by holding down the interaction button instead of pressing it. // Only do this if the throwable is moving faster than the prescribed threshold speed, // and if it isn't attached to another hand if (!attached) { if (hand.GetStandardInteractionButton()) { } } if (showHint) { ControllerButtonHints.ShowButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); } }
//------------------------------------------------- public void DisableHints() { if (buttonHintCoroutine != null) { StopCoroutine(buttonHintCoroutine); buttonHintCoroutine = null; } if (textHintCoroutine != null) { StopCoroutine(textHintCoroutine); textHintCoroutine = null; } foreach (Hand hand in SteamVR_Player.instance.hands) { ControllerButtonHints.HideAllButtonHints(hand); ControllerButtonHints.HideAllTextHints(hand); } }
//------------------------------------------------- // Cycles through all the button hints on the controller //------------------------------------------------- private IEnumerator HintCoroutine() { Hand hand = player.rightHand; while (true) { if (action.GetActive(hand.handType)) { ControllerButtonHints.ShowTextHint(hand, action, "Grab Toy"); } else { ControllerButtonHints.HideButtonHint(hand, action); } yield return(new WaitForSeconds(3.0f)); yield return(null); } }
private void HandHoverUpdate(Hand hand) { //Trigger got pressed if (hand.GetStandardInteractionButtonDown() && onButtonPress != null) { onButtonPress.Invoke(); //ControllerButtonHints.HideTextHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); ToggleRecording(); audioSource.Play(); } if (isRecording) { ControllerButtonHints.ShowTextHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger, endHintText); } else { ControllerButtonHints.ShowTextHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger, beginHintText); } }
//------------------------------------------------- private void OnHandHoverBegin(Hand hand) { ItemPackage currentAttachedItemPackage = GetAttachedItemPackage(hand); if (currentAttachedItemPackage == itemPackage) // the item at the top of the hand's stack has an associated ItemPackage { if (takeBackItem && !requireTriggerPressToReturn) // if we want to take back matching items and aren't waiting for a trigger press { TakeBackItem(hand); } } if (!requireTriggerPressToTake) // we don't require trigger press for pickup. Spawn and attach object. { SpawnAndAttachObject(hand); } if (requireTriggerPressToTake && showTriggerHint) { ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_SteamVR_Trigger, "PickUp"); } }
// Update is called once per frame void Update() { if (controller != null) { //Debug.Log("Controller not null!"); if (controller.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu)) { if (GameManager.paused) { ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); //hide button hint when closing menu } GameManager.menuPressed = true; highlighter.HideHighlight(); } } else { hand = gameObject.GetComponent <Hand>(); controller = hand.controller; highlighter = gameObject.GetComponentInChildren <ControllerHoverHighlight>(); } }
public void ImageRecog() // 이미지 인식버튼 이벤트 호출 { // 게임 종료시에 이벤트 호출 player.GetComponent <ButtonEvent>().BtnImgCheck(); if (buttonHintCoroutine != null) { StopCoroutine(buttonHintCoroutine); buttonHintCoroutine = null; } if (textHintCoroutine != null) { StopCoroutine(textHintCoroutine); textHintCoroutine = null; } foreach (Hand hand in Player.instance.hands) { ControllerButtonHints.HideAllButtonHints(hand); ControllerButtonHints.HideAllTextHints(hand); } }
//------------------------------------------------- public void GameEnd() // 게임종료 버튼 { // 게임 종료시에 이벤트 호출 player.GetComponent <ButtonEvent>().BtnEndPy(); if (buttonHintCoroutine != null) { StopCoroutine(buttonHintCoroutine); buttonHintCoroutine = null; } if (textHintCoroutine != null) { StopCoroutine(textHintCoroutine); textHintCoroutine = null; } foreach (Hand hand in Player.instance.hands) { ControllerButtonHints.HideAllButtonHints(hand); ControllerButtonHints.HideAllTextHints(hand); } }
//------------------------------------------------- // Cycles through all the text hints on the controller //------------------------------------------------- private IEnumerator TestTextHints(Hand hand) { ControllerButtonHints.HideAllTextHints(hand); while (true) { for (int actionIndex = 0; actionIndex < SteamVR_Input.actionsIn.Length; actionIndex++) { ISteamVR_Action_In action = SteamVR_Input.actionsIn[actionIndex]; if (action.GetActive(hand.handType)) { ControllerButtonHints.ShowTextHint(hand, action, action.GetShortName()); yield return(new WaitForSeconds(3.0f)); ControllerButtonHints.HideTextHint(hand, action); yield return(new WaitForSeconds(0.5f)); } yield return(null); } ControllerButtonHints.HideAllTextHints(hand); yield return(new WaitForSeconds(3.0f)); } }