Exemple #1
0
        void UpdateBrushControllerGripState()
        {
            BaseControllerBehavior behavior =
                InputManager.m_Instance.GetControllerBehavior(InputManager.ControllerName.Brush);
            bool  gripReady    = m_BrushInWidgetRange || (m_DesiredVisualState == VisualState.WorldWandGrip);
            float visualAmount = m_DesiredVisualState == VisualState.WidgetBrushGrip ? 1.0f : 0.5f;

            behavior.EnableTransformVisuals(m_BrushInWidgetRange, visualAmount);
            behavior.SetGripState(gripReady ?
                                  BaseControllerBehavior.GripState.ReadyToGrip :
                                  BaseControllerBehavior.GripState.Standard);
        }
Exemple #2
0
        void SwitchState()
        {
            InputManager.ControllerName wand          = InputManager.ControllerName.Wand;
            InputManager.ControllerName brush         = InputManager.ControllerName.Brush;
            BaseControllerBehavior      wandBehavior  = InputManager.m_Instance.GetControllerBehavior(wand);
            BaseControllerBehavior      brushBehavior = InputManager.m_Instance.GetControllerBehavior(brush);

            // Short circuit out of certain states if all the pieces don't fit.
            if (m_DesiredVisualState == VisualState.WorldBrushGrip)
            {
                if (!InputManager.Wand.IsTrackedObjectValid)
                {
                    m_DesiredVisualState = VisualState.Off;
                }
            }
            else if (m_DesiredVisualState == VisualState.WorldWandGrip)
            {
                if (!InputManager.Brush.IsTrackedObjectValid)
                {
                    m_DesiredVisualState = VisualState.Off;
                }
            }

            switch (m_DesiredVisualState)
            {
            case VisualState.Off:
                m_LineDrawInTime              = 0.0f;
                m_LineT                       = 0.0f;
                m_LineRenderer.enabled        = false;
                m_LineOutlineRenderer.enabled = false;
                UpdateWandControllerGripState();
                UpdateBrushControllerGripState();
                m_AnimalRulerAnchor.gameObject.SetActive(false);
                SetAnimalRulerScale(0);
                m_AnimalRulerRequestVisible = false;
                break;

            case VisualState.WorldWandGrip:
            case VisualState.WidgetWandGrip:
                m_LineRenderer.material.SetFloat("_Intensity", m_HintIntensity);
                m_Intensity                   = m_HintIntensity;
                m_LineRenderer.enabled        = true;
                m_LineOutlineRenderer.enabled = true;
                wandBehavior.EnableTransformVisuals(true, 0.5f);
                wandBehavior.SetGripState(BaseControllerBehavior.GripState.Gripped);
                UpdateBrushControllerGripState();
                m_AnimalRulerAnchor.gameObject.SetActive(false);
                m_AnimalRulerRequestVisible = false;
                break;

            case VisualState.WorldBrushGrip:
            case VisualState.WidgetBrushGrip:
                m_LineRenderer.material.SetFloat("_Intensity", m_HintIntensity);
                m_Intensity                   = m_HintIntensity;
                m_LineRenderer.enabled        = true;
                m_LineOutlineRenderer.enabled = true;
                brushBehavior.EnableTransformVisuals(true, 0.5f);
                brushBehavior.SetGripState(BaseControllerBehavior.GripState.Gripped);
                UpdateWandControllerGripState();
                m_AnimalRulerAnchor.gameObject.SetActive(false);
                m_AnimalRulerRequestVisible = false;
                break;

            case VisualState.WorldDoubleGrip:
                m_LineT                       = 1.0f;
                m_Intensity                   = 1.0f;
                m_LineRenderer.enabled        = true;
                m_LineOutlineRenderer.enabled = true;
                m_LineRenderer.material.SetFloat("_Intensity", 1.0f);
                wandBehavior.EnableTransformVisuals(true, 1.0f);
                wandBehavior.SetGripState(BaseControllerBehavior.GripState.Gripped);
                brushBehavior.EnableTransformVisuals(true, 1.0f);
                brushBehavior.SetGripState(BaseControllerBehavior.GripState.Gripped);
                m_AnimalRulerAnchor.gameObject.SetActive(true);
                m_AnimalRulerRequestVisible = true;
                break;
            }

            m_CurrentVisualState = m_DesiredVisualState;
        }