Exemplo n.º 1
0
    private IEnumerator OpenPlayerInfo(PlayerInfoSide side)
    {
        string sideTooltipTmp      = side.tooltips.gripText;
        string othersideTooltipTmp = side.tooltipsOther.gripText;

        side.tooltips.UpdateText(VRTK_ControllerTooltips.TooltipButtons.GripTooltip, openingTooltip);
        side.tooltipsOther.UpdateText(VRTK_ControllerTooltips.TooltipButtons.GripTooltip, "");
        side.fillBar.localScale = new Vector3(0f, 1f, 1f);
        float startTime = Time.time;

        while (Time.time < startTime + gripHoldTime)
        {
            if (!side.events.gripPressed)
            {
                openPlayerInfoRoutine = null;
                side.tooltips.UpdateText(VRTK_ControllerTooltips.TooltipButtons.GripTooltip, sideTooltipTmp);
                side.tooltipsOther.UpdateText(VRTK_ControllerTooltips.TooltipButtons.GripTooltip, othersideTooltipTmp);
                side.fillBar.localScale = new Vector3(0f, 1f, 1f);
                yield break;
            }
            side.fillBar.localScale = new Vector3((Time.time - startTime) / gripHoldTime, 1f, 1f);
            yield return(null);
        }

        side.playerInfoView.SetActive(true);
        side.uiPointer.SetActive(true);
        if (OnPlayerInfoViewOpened != null)
        {
            OnPlayerInfoViewOpened();
        }
        side.fillBar.localScale = new Vector3(0f, 1f, 1f);
        side.tooltips.UpdateText(VRTK_ControllerTooltips.TooltipButtons.GripTooltip, closeTooltip);
        openPlayerInfoRoutine = null;
    }
Exemplo n.º 2
0
    IEnumerator Start()
    {
        vrtk_manager = FindObjectOfType <VRTK_SDKManager> ();
        outfitter    = FindObjectOfType <Outfitter> ();
        while (!outfitter.setupFinished)
        {
            yield return(null);
        }

        rightUIPointer = vrtk_manager.scriptAliasRightController.transform.Find("UIPointer").gameObject;
        leftUIPointer  = vrtk_manager.scriptAliasLeftController.transform.Find("UIPointer").gameObject;

        leftPlayerInfoView = Instantiate <GameObject> (playerInfoViewPrefab, Vector3.zero, Quaternion.identity);
        leftPlayerInfoView.transform.SetParent(vrtk_manager.scriptAliasLeftController.transform);
        leftPlayerInfoView.transform.localPosition = new Vector3(0.27f, 0, -0.03f);
        leftPlayerInfoView.transform.localRotation = playerInfoViewPrefab.transform.rotation;

        rightPlayerInfoView = Instantiate <GameObject> (playerInfoViewPrefab, Vector3.zero, Quaternion.identity);
        rightPlayerInfoView.transform.SetParent(vrtk_manager.scriptAliasRightController.transform);
        rightPlayerInfoView.transform.localPosition = new Vector3(-0.27f, 0, -0.03f);
        rightPlayerInfoView.transform.localRotation = playerInfoViewPrefab.transform.rotation;

        left = new PlayerInfoSide {
            events         = vrtk_manager.scriptAliasLeftController.GetComponent <VRTK_ControllerEvents> (),
            tooltips       = outfitter.leftControllerTooltips,
            tooltipsOther  = outfitter.rightControllerTooltips,
            fillBar        = leftTooltipFillbar,
            playerInfoView = leftPlayerInfoView,
            uiPointer      = rightUIPointer
        };
        right = new PlayerInfoSide {
            events         = vrtk_manager.scriptAliasRightController.GetComponent <VRTK_ControllerEvents> (),
            tooltips       = outfitter.rightControllerTooltips,
            tooltipsOther  = outfitter.leftControllerTooltips,
            fillBar        = rightTooltipFillbar,
            playerInfoView = rightPlayerInfoView,
            uiPointer      = leftUIPointer
        };

        SetAllInactive();
        if (available)
        {
            SetAvailable();
        }
    }