Ejemplo n.º 1
0
        public virtual void Update()
        {
            if (!_mainCam)
            {
                return;
            }

            switch (mode)
            {
            case Mode.FPS:
                OnFpsUpdate();
                break;

            case Mode.LERP:
                if (lerpYourself)
                {
                    lerpData.Reset();

                    Portion(lerpData);

                    Lerp(lerpData, false);

                    if (lerpData.MinPortion == 1)
                    {
                        mode         = Mode.FPS;
                        lerpYourself = false;
                    }
                }

                break;
            }

            //UpdateCameraSmoothing();
            AdjustCamera();
        }
Ejemplo n.º 2
0
        void Update()
        {
            if (!stopTime)
            {
                MyTime += Time.deltaTime * _simulationSpeed.Value;
            }

            foamTimeAndPosition.GlobalValue = new Vector4(MyTime, MyTime * 0.6f, transform.position.y, 0);

            // Reset portion to be 1
            ld.Reset();

            // Find slowest property
            shadowColor.Portion(ld);
            _thickness.Portion(ld);
            _simulationSpeed.Portion(ld);
            _noise.Portion(ld);
            upscale.Portion(ld);
            shadowStrength.Portion(ld);
            shadowDistance.Portion(ld);
            fogColor.Portion(ld);
            skyColor.Portion(ld);
            fogDensity.Portion(ld);
            fogDistance.Portion(ld);

            // Lerp all the properties
            shadowColor.Lerp(ld);
            _thickness.Lerp(ld);
            _simulationSpeed.Lerp(ld);
            _noise.Lerp(ld);
            upscale.Lerp(ld);
            shadowStrength.Lerp(ld);
            shadowDistance.Lerp(ld);
            fogColor.Lerp(ld);
            skyColor.Lerp(ld);
            fogDensity.Lerp(ld);
            fogDistance.Lerp(ld);


            if (modifyProjectSettings)
            {
                RenderSettings.fogColor = fogColor.Value;

                if (RenderSettings.fog)
                {
                    RenderSettings.fogEndDistance = fogDistance.Value;
                    RenderSettings.fogDensity     = fogDensity.Value;
                }



                //RenderSettings. = fogDistance.Value;
                RenderSettings.ambientSkyColor = skyColor.Value;
                QualitySettings.shadowDistance = shadowDistance.Value;
            }

            UpdateShaderProperties();
        }
Ejemplo n.º 3
0
            public override bool Update(RoundedGraphic target)
            {
                ld.Reset();

                _roundedCorners.Portion(ld, target._mouseOver ? valueWhenOver : valueWhenOff);

                _roundedCorners.Lerp(ld);

                if (_roundedCorners.CurrentValue != target.GetCorner(0))
                {
                    target.SetCorners(_roundedCorners.CurrentValue);
                    return(true);
                }

                return(false);
            }
Ejemplo n.º 4
0
        public void Update()
        {
            if (!_lerpDone)
            {
                ld.Reset();

                Portion(ld);

                Lerp(ld, false);

                if (ld.MinPortion > 0.999f)
                {
                    _lerpDone = true;
                }
            }
        }
Ejemplo n.º 5
0
        public void Update()
        {
            ld.Reset();

            var cfg = RayMarchingConfig.ActiveConfig;

            _rayMarchSmoothness.Portion(ld, smoothness.Value);
            _RayMarchLightColor.Portion(ld, _lightColor);
            _rayMarchShadowSoftness.Portion(ld, shadowSoftness.Value);
            _RayMarchFogColor.Portion(ld, _fogColor);
            _RayMarchReflectionColor.Portion(ld, _reflectionColor);

            _rayMarchSmoothness.Lerp(ld);
            _RayMarchLightColor.Lerp(ld);
            _rayMarchShadowSoftness.Lerp(ld);
            _RayMarchFogColor.Lerp(ld);
            _RayMarchReflectionColor.Lerp(ld);
        }
Ejemplo n.º 6
0
        protected override void DerivedUpdate()
        {
            base.DerivedUpdate();

            if (Input.GetKey(KeyCode.Escape))
            {
                OnDisable();
                Application.Quit();
                Debug.Log("Quit click");
            }

            _ld.Reset();

            modesAsLinkedLeprs.Portion(_ld);
            systemAsLinkedLeprs.Portion(_ld);

            modesAsLinkedLeprs.Lerp(_ld);
            systemAsLinkedLeprs.Lerp(_ld);
        }
Ejemplo n.º 7
0
        void Update()
        {
            lerpData.Reset();

            upperColor.Portion(lerpData);
            middleColor.Portion(lerpData);
            bottomColor.Portion(lerpData);
            gradientMiddle.Portion(lerpData);
            mainMenu.Portion(lerpData);

            //Making sure that the visual transition is synchronized

            upperColor.Lerp(lerpData);
            middleColor.Lerp(lerpData);
            bottomColor.Lerp(lerpData);
            gradientMiddle.Lerp(lerpData);
            mainMenu.Lerp(lerpData, false);

            particlesOffset.lastValue += configuration.particlesSpeed * Time.deltaTime * player.speed;

            particlesOffset.SetOn(particlesMaterial);
        }
Ejemplo n.º 8
0
    public void Update()
    {
        ld.Reset();

        int activeCount = 0;

        foreach (var op in optionsPool)
        {
            activeCount += op.isFadingOut ? 0 : 1;
        }

        singlePhraseBoxHeight.Portion(ld, activeCount > 0 ? 0 : 1);
        historyPool.active.Portion(ld);
        optionsPool.active.Portion(ld);

        bool lerpSeparator = false;

        if (Math.Abs(separatorPosition.TargetValue - separatorPosition.CurrentValue) > 0.00001f || poolsDirty)
        {
            lerpSeparator = true;
            poolsDirty    = false;
            separatorPosition.Portion(ld, Mathf.Min(0.6f, 0.3f + activeCount * 0.2f));
        }

        // LERP:

        singlePhraseBoxHeight.Lerp(ld);
        historyPool.active.Lerp(ld);
        optionsPool.active.Lerp(ld);

        if (lerpSeparator)
        {
            separatorPosition.Lerp(ld);
        }

        //ld.LerpAndReset();

        var   tf           = singlePhraseBg.rectTransform;
        var   size         = tf.sizeDelta;
        float curBoxFadeIn = singlePhraseBoxHeight.CurrentValue;

        size.y = curBoxFadeIn * 400;
        singlePhraseBg.TrySetAlpha_DisableGameObjectIfZero(curBoxFadeIn * 20);
        singlePhraseText.TrySetAlpha_DisableGameObjectIfZero((curBoxFadeIn - 0.9f) * 10);
        tf.sizeDelta = size;

        if (lerpSeparator)
        {
            UpdateCourners();
        }

        const float scrollbackSpeed = 1000;

        if (state == ScrollingState.None)
        {
            if (Input.GetMouseButton(0))
            {
                state = (Input.mousePosition.y / Screen.height) > separatorPosition.CurrentValue
                    ? ScrollingState.ScrollingHistory
                    : ScrollingState.ScrollingOptions;

                prevousMousePos = Input.mousePosition;

                scrollSoundPlayed = false;
            }
        }
        else
        {
            if (!Input.GetMouseButton(0))
            {
                state = ScrollingState.None;
            }
            else
            {
                float diff = Input.mousePosition.y - prevousMousePos.y;

                bool up = diff > 0;

                if ((!scrollSoundPlayed || (up != scrollSoundPlayedUp)) && Mathf.Abs(diff) > 10)
                {
                    scrollSoundPlayedUp = up;
                    scrollSoundPlayed   = true;
                }

                (state == ScrollingState.ScrollingHistory ? historyScroll : optionsScroll).AddOffset(diff);

                prevousMousePos = Input.mousePosition;
            }
        }

        if (scrollHistoryUpRequested && state != ScrollingState.None)
        {
            scrollHistoryUpRequested = false;
        }

        float pos = historyScroll.offset;

        foreach (var h in historyPool.active)
        {
            var rt   = h.rectTransform;
            var anch = rt.anchoredPosition;
            anch.y = pos;
            rt.anchoredPosition = anch;
            pos += historyScroll.gap;
        }

        if (state != ScrollingState.ScrollingHistory)
        {
            historyScroll.ApplyInnertia();

            bool outOfList = true;

            if (historyScroll.offset > 0 || scrollHistoryUpRequested)
            {
                LerpUtils.IsLerpingBySpeed(ref historyScroll.offset, 0, scrollbackSpeed);
            }
            else if (pos < historyScroll.gap)
            {
                LerpUtils.IsLerpingBySpeed(ref historyScroll.offset, historyScroll.offset + historyScroll.gap - pos, scrollbackSpeed);
            }
            else
            {
                outOfList = false;
            }

            if (outOfList)
            {
                historyScroll.FadeInnertia();
            }
        }

        pos = optionsScroll.offset;

        foreach (var h in optionsPool.active)
        {
            if (!h.isFadingOut)
            {
                var rt   = h.rectTransform;
                var anch = rt.anchoredPosition;
                anch.y = pos;
                rt.anchoredPosition = anch;
                pos -= optionsScroll.gap;
            }
        }

        if (state != ScrollingState.ScrollingOptions)
        {
            optionsScroll.ApplyInnertia();

            bool outOfTheList = true;

            if (optionsScroll.offset < 0)
            {
                LerpUtils.IsLerpingBySpeed(ref optionsScroll.offset, 0, scrollbackSpeed);
            }
            else if (pos > -optionsScroll.gap)
            {
                LerpUtils.IsLerpingBySpeed(ref optionsScroll.offset, optionsScroll.offset - optionsScroll.gap - pos, scrollbackSpeed);
            }
            else
            {
                outOfTheList = false;
            }

            if (outOfTheList)
            {
                optionsScroll.FadeInnertia();
            }
        }
    }