Пример #1
0
    public override void DoUpdate(SceneManager context)
    {
        if (menu.IsClicked)
        {
            SceneManager.Instance.StateTransition(SceneManager.Instance.menuScene);
        }
        else if (restart.IsClicked)
        {
            SceneManager.Instance.StateTransition(SceneManager.Instance.visionScene);
        }
        else if (nextLab.IsClicked)
        {
            SceneManager.Instance.StateTransition(SceneManager.Instance.minecartScene);
        }
        else
        {
            if (VRInput.Instance.PrimaryButton.Pressed)
            {
                IncrementCarouselAngle();
            }
        }
        if ((VRInput.Instance.Pitch) < -30)
        {
            VRInput.Instance.ReticleColor = new Color(0, 0, 0, 0.5f);
        }
        else
        {
            VRInput.Instance.ReticleColor = new Color(0, 0, 0, 0);
        }
        currentAngle           = Smoothing.SpringSmoothAngle(currentAngle, targetAngle, ref angleSpeed, 0.25f, Time.deltaTime);
        carousel.localRotation = Quaternion.AngleAxis(currentAngle, Vector3.up);

        if (!completedCycle)
        {
            for (int i = 0; i < elements.Length; i++)
            {
                elements[i].targetAlpha = 0;
            }
            elements[carouselIdx].targetAlpha = 1;
        }
        for (int i = 0; i < elements.Length; i++)
        {
            CarouselElement e = elements[i];
            if (e.targetAlpha != e.currentAlpha)
            {
                e.currentAlpha = Smoothing.SpringSmooth(e.currentAlpha, e.targetAlpha, ref e.alphaSpeed, 0.25f, Time.deltaTime);
                Color c = e.titleTextRenderer.color;
                c.a = e.currentAlpha;
                e.titleTextRenderer.color = c;
                e.bodyTextRenderer.color  = c;

                if (e.lineMeshRenderer != null)
                {
                    c   = e.lineMeshRenderer.material.color;
                    c.a = e.currentAlpha;
                    e.lineMeshRenderer.material.color = c;
                }

                if (e.ringMeshRenderer != null)
                {
                    c   = e.ringMeshRenderer.material.color;
                    c.a = e.currentAlpha;
                    e.ringMeshRenderer.material.color = c;
                }

                if (e.dotMeshRenderer != null)
                {
                    c   = e.dotMeshRenderer.material.color;
                    c.a = e.currentAlpha;
                    e.dotMeshRenderer.material.color = c;
                }
                if (e.otherRenderer != null)
                {
                    c   = e.otherRenderer.color;
                    c.a = e.currentAlpha;
                    e.otherRenderer.color = c;
                }
                if (e.plateRenderer != null)
                {
                    c   = e.plateRenderer.material.color;
                    c.a = e.currentAlpha * e.plateAlpha;
                    e.plateRenderer.material.color = c;
                }
            }
        }
    }