Esempio n. 1
0
        public static void SetRightHanded(bool value)
        {
            if (null != Instance.secondaryControllerDisplay && Settings.rightHanded == value)
            {
                return;
            }

            Settings.rightHanded = value;

            GameObject leftHandleRightController = Instance.paletteController.Find("right_controller").gameObject;
            GameObject leftHandleLeftController  = Instance.paletteController.Find("left_controller").gameObject;

            GameObject rightHandleRightController = Instance.toolsController.Find("right_controller").gameObject;
            GameObject rightHandleLeftController  = Instance.toolsController.Find("left_controller").gameObject;

            leftHandleLeftController.SetActive(value);
            leftHandleRightController.SetActive(!value);
            rightHandleRightController.SetActive(value);
            rightHandleLeftController.SetActive(!value);

            // Update controller's displays
            Instance.primaryControllerDisplay        = GetPrimaryControllerTransform().Find("Canvas/Text").GetComponent <TextMeshProUGUI>();
            Instance.secondaryControllerDisplay      = GetSecondaryControllerTransform().Find("Canvas/Text").GetComponent <TextMeshProUGUI>();
            Instance.secondaryControllerDisplay.text = "";
            Instance.primaryControllerDisplay.text   = "";

            // Update tooltips
            Tooltips.HideAll(VRDevice.PrimaryController);
            Tooltips.HideAll(VRDevice.SecondaryController);
            ToolBase tool = ToolsManager.CurrentTool();

            if (null != tool)
            {
                tool.SetTooltips();
            }
            Instance.playerController.HandleCommonTooltipsVisibility();

            // Move Palette
            Transform palette = Instance.paletteController.Find("PaletteHandle");
            Vector3   currentPalettePosition = palette.localPosition;

            if (Settings.rightHanded)
            {
                palette.localPosition = new Vector3(-0.02f, currentPalettePosition.y, currentPalettePosition.z);
            }
            else
            {
                palette.localPosition = new Vector3(-0.2f, currentPalettePosition.y, currentPalettePosition.z);
            }
        }
Esempio n. 2
0
        public void SetRightHanded(bool value)
        {
            inverseRightController.controllerTransform.gameObject.SetActive(!value);
            inverseLeftController.controllerTransform.gameObject.SetActive(!value);
            rightController.controllerTransform.gameObject.SetActive(value);
            leftController.controllerTransform.gameObject.SetActive(value);

            Transform toolsController   = GlobalState.Instance.toolsController;
            Transform paletteController = GlobalState.Instance.paletteController;


            // Update controller's displays
            rightController.controllerDisplay.text        = "";
            inverseRightController.controllerDisplay.text = "";
            leftController.controllerDisplay.text         = "";
            inverseLeftController.controllerDisplay.text  = "";

            // Update tooltips
            Tooltips.HideAll(VRDevice.PrimaryController);
            Tooltips.HideAll(VRDevice.SecondaryController);
            ToolBase tool = ToolsManager.CurrentTool();

            if (null != tool)
            {
                tool.SetTooltips();
            }
            GlobalState.Instance.playerController.HandleCommonTooltipsVisibility();

            Transform palette = GlobalState.Instance.paletteController.Find("PaletteHandle");

            if (value)
            {
                SetHolders(leftController, rightController, toolsController, paletteController, palette);
            }
            else
            {
                SetHolders(inverseRightController, inverseLeftController, toolsController, paletteController, palette);
            }
        }