EaseInOut() public static method

public static EaseInOut ( double linearStep, EasingType type ) : float
linearStep double
type EasingType
return float
Ejemplo n.º 1
0
    public static IEnumerator FadeMaterial(Material materialToFade, float alphaTo, float time, EasingType ease)
    {
        var t = 0f;

        if (!materialToFade.HasProperty("_Color"))
        {
            yield break;
        }

        float startingAlpha = materialToFade.color.a;

        while (t < 1f)
        {
            Color newColour = materialToFade.color;
            newColour.a          = Mathf.Lerp(startingAlpha, alphaTo, Easing.EaseInOut(t, ease));
            materialToFade.color = newColour;

            t += Time.deltaTime / time;
            yield return(null);
        }

        Color finalColour = materialToFade.color;

        finalColour.a        = alphaTo;
        materialToFade.color = finalColour;
    }
Ejemplo n.º 2
0
    void SetAlpha()
    {
        if (IsGizmo)
        {
            if (FaceSelector.GetComponentInChildren <Renderer>().enabled == false)
            {
                var r = gameObject.FindChild("CubeInsideout").renderer;
                var c = r.material.GetColor("_TintColor");
                r.material.SetColor("_TintColor", new Color(c.r, c.g, c.b, (13 / 255f) * (Mathf.Sin(Time.realtimeSinceStartup * 10) * 0.25f + 1)));
            }
            else
            {
                var r = gameObject.FindChild("CubeInsideout").renderer;
                var c = r.material.GetColor("_TintColor");
                r.material.SetColor("_TintColor", new Color(c.r, c.g, c.b, (13 / 255f)));

                r = FaceSelector.GetComponentInChildren <Renderer>();
                c = r.material.color;
                r.material.color = new Color(c.r, c.g, c.b, 1 + Mathf.Sin(Time.realtimeSinceStartup * 10) * 0.25f);
            }
        }
        else
        {
            var eased = Easing.EaseInOut(Mathf.Clamp01(Pico.Level.SinceAlive), EasingType.Sine);
            var r     = gameObject.FindChild("CubeInsideout").renderer;
            var c     = r.material.GetColor("_TintColor");
            r.material.SetColor("_TintColor", new Color(c.r, c.g, c.b, eased * (13 / 255f)));
            //r = gameObject.FindChild("Pyramid").renderer;
            //r.material.color = new Color(r.material.color.r, r.material.color.g, r.material.color.b, eased);
        }
    }
Ejemplo n.º 3
0
    public IEnumerator Action()
    {
        if (to_play_if_movement != null)
        {
            LevelManager.Instance.AudioSource.PlayOneShot(to_play_if_movement);
        }

        if (moveDuration > 0)
        {
            Vector3 prePos  = transform.position;
            Vector3 nextPos = prePos + Vector3.right;


            float pourcent = 0;

            while (pourcent < 1)
            {
                pourcent += Time.deltaTime / moveDuration;

                transform.position = Vector3.LerpUnclamped(prePos, nextPos, Easing.EaseInOut(pourcent, EasingType.Back));

                yield return(null);
            }
        }
        else
        {
            transform.position += Vector3.right;
        }
    }
    IEnumerator FitHandler()
    {
        float time = 0;

        while (time < TransitionDuration)
        {
            var easedStep = Easing.EaseInOut(time / TransitionDuration, TransitionEasingType);

            ColorTabRect.sizeDelta = new Vector2(
                ColorTabRect.sizeDelta.x,
                Mathf.Lerp(originalHeight, targetHeight, easedStep));
            for (int i = 0; i < SubTabs.Length; i++)
            {
                SubTabs[i].CurrentPosition = Vector2.Lerp(
                    SubTabs[i].OriginalPosition,
                    SubTabs[i].TargetPosition, easedStep);
            }

            time += Time.deltaTime;
            yield return(null);
        }

        ColorTabRect.sizeDelta = new Vector2(ColorTabRect.sizeDelta.x, targetHeight);
        for (int i = 0; i < SubTabs.Length; i++)
        {
            SubTabs[i].CurrentPosition = SubTabs[i].TargetPosition;
        }
    }
Ejemplo n.º 5
0
    void Update()
    {
        if (!m_bIsActive)
        {
            return;
        }

        // Where should we be, in time, along the path?
        float fRatio = (TimerManager.fGameTime - m_fEventTime) / m_fDuration;
        float fDir;

        if (!m_bIsForward)
        {
            fDir = 1.0f - fRatio;
        }
        else
        {
            fDir = fRatio;
        }

        // If we've gone off the end, check now and flip for the next update
        if (fRatio >= 1.0f)
        {
            m_fEventTime = TimerManager.fGameTime;
            m_bIsForward = !m_bIsForward;
        }

        // Set the transform of this object to where we should be...
        transform.position = m_BezierCurveComponent.GetPoint(Easing.EaseInOut(fDir, m_iEasing));
    }
Ejemplo n.º 6
0
 private void ShineOnYouCrazyDiamonds(float elapsedTime)
 {
     this.UntilNextShine -= elapsedTime;
     if ((double)this.UntilNextShine <= 0.0 && this.TrackedBits.Count > 0 && (this.PlayerManager.CanControl && this.CameraManager.ViewTransitionReached))
     {
         this.UntilNextShine               = 7f;
         this.ChimeOutline.Scale           = new Vector3(0.1f);
         this.ChimeOutline.Groups[0].Scale = Vector3.One;
         this.ChimeOutline.Groups[1].Scale = Vector3.One;
         this.ChimeOutline.Groups[2].Scale = Vector3.One;
         this.ChimeOutline.Groups[3].Scale = Vector3.One;
         this.ShineOn = RandomHelper.InList <TrileInstance>(this.TrackedBits);
         SoundEffectExtensions.EmitAt(this.sBitChime, this.ShineOn.Center);
     }
     if (this.ShineOn == null)
     {
         return;
     }
     this.ChimeOutline.Position         = this.ShineOn.Center;
     this.ChimeOutline.Rotation         = this.CameraManager.Rotation;
     this.ChimeOutline.Scale            = new Vector3((float)((double)Easing.EaseInOut((double)FezMath.Saturate(7f - this.UntilNextShine), EasingType.Quadratic) * 10.0 + (double)Easing.EaseIn(7.0 - (double)this.UntilNextShine, EasingType.Quadratic) * 7.0)) * 0.75f;
     this.ChimeOutline.Groups[0].Scale /= 1.002f;
     this.ChimeOutline.Groups[1].Scale /= 1.006f;
     this.ChimeOutline.Groups[2].Scale /= 1.012f;
     this.ChimeOutline.Groups[3].Scale /= 1.018f;
     this.ChimeOutline.Material.Diffuse = new Vector3((float)((double)Easing.EaseIn((double)FezMath.Saturate((float)(1.0 - (double)this.ChimeOutline.Scale.X / 40.0)), EasingType.Quadratic) * (1.0 - (double)this.TimeManager.NightContribution * 0.649999976158142) * (1.0 - (double)this.TimeManager.DawnContribution * 0.699999988079071) * (1.0 - (double)this.TimeManager.DuskContribution * 0.699999988079071)));
     this.ChimeOutline.Blending         = new BlendingMode?(BlendingMode.Additive);
     if ((double)this.ChimeOutline.Scale.X <= 40.0)
     {
         return;
     }
     this.ShineOn = (TrileInstance)null;
 }
Ejemplo n.º 7
0
    void Update()
    {
        if (timeSinceStateChange < letterboxAppearTime)
        {
            timeSinceStateChange += Time.deltaTime;

            float t = timeSinceStateChange / letterboxAppearTime;
            t = Easing.EaseInOut(t);

            Color targetColor = Color.black;
            targetColor.a = isPlayingFlythrough ? 1 : 0;
            Color startColor = targetColor;
            startColor.a = 1 - startColor.a;

            topLetterboxBar.color    = Color.Lerp(startColor, targetColor, t);
            bottomLetterboxBar.color = Color.Lerp(startColor, targetColor, t);

            float botTarget = isPlayingFlythrough ? Mathf.Lerp(0, letterboxHeight, t) : Mathf.Lerp(letterboxHeight, 0, t);
            float topTarget = 1 - botTarget;

            Vector2 topAnchorMin = topLetterboxBar.rectTransform.anchorMin;
            topAnchorMin.y = topTarget;
            topLetterboxBar.rectTransform.anchorMin = topAnchorMin;

            Vector2 botAnchorMax = bottomLetterboxBar.rectTransform.anchorMax;
            botAnchorMax.y = botTarget;
            bottomLetterboxBar.rectTransform.anchorMax = botAnchorMax;
        }
    }
Ejemplo n.º 8
0
 public override void Draw(GameTime gameTime)
 {
     if (this.ActiveState == ZoomOut.State.Wait || this.GameState.Loading || (double)this.StepTime <= 25.0)
     {
         return;
     }
     this.TargetRenderer.DrawFullscreen(new Color(0.2705882f, 0.9764706f, 1f, Easing.EaseInOut((double)FezMath.Saturate((float)(((double)this.StepTime - 25.0) / 7.0)), EasingType.Sine)));
 }
Ejemplo n.º 9
0
        public override void Update(GameTime gameTime)
        {
            if (this.IsDisposed || this.GameState.Paused)
            {
                return;
            }
            if (this.TransitionStarted)
            {
                this.SinceStarted += (float)(gameTime.ElapsedGameTime.TotalSeconds * (this.Inverted ? -0.100000001490116 : (this.DoubleTime ? 2.0 : (this.HalfSpeed ? 0.75 : 1.0))));
            }
            float num = Math.Min(Easing.EaseIn((double)FezMath.Saturate(this.SinceStarted / 5f), EasingType.Sine), 0.999f);

            this.Zoom = num;
            if ((double)this.LogoMesh.Material.Opacity == 1.0 && this.Glitched && (double)num <= 0.75)
            {
                this.untilGlitch -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                if ((double)this.untilGlitch <= 0.0)
                {
                    this.untilGlitch      = RandomHelper.Between(1.0 / 3.0, 2.0);
                    this.glitchTilt[0]    = RandomHelper.Between(0.0, 1.0);
                    this.glitchTilt[1]    = RandomHelper.Between(0.0, 1.0);
                    this.glitchTilt[2]    = RandomHelper.Between(0.0, 1.0);
                    this.glitchOpacity[0] = RandomHelper.Between(0.25, 1.0);
                    this.glitchOpacity[1] = RandomHelper.Between(0.25, 1.0);
                    this.glitchOpacity[2] = RandomHelper.Between(0.25, 1.0);
                    this.glitchScale[0]   = new Vector3(RandomHelper.Between(0.75, 1.5), RandomHelper.Between(0.75, 1.5), RandomHelper.Between(0.75, 1.5));
                    this.glitchScale[1]   = new Vector3(RandomHelper.Between(0.75, 1.5), RandomHelper.Between(0.75, 1.5), RandomHelper.Between(0.75, 1.5));
                    this.glitchScale[2]   = new Vector3(RandomHelper.Between(0.75, 1.5), RandomHelper.Between(0.75, 1.5), RandomHelper.Between(0.75, 1.5));
                    this.forFrames        = RandomHelper.Random.Next(1, 7);
                    if (RandomHelper.Probability(1.0 / 3.0))
                    {
                        SoundEffectExtensions.Emit(this.sGlitch1);
                    }
                    if (RandomHelper.Probability(0.5))
                    {
                        SoundEffectExtensions.Emit(this.sGlitch2);
                    }
                    else
                    {
                        SoundEffectExtensions.Emit(this.sGlitch3);
                    }
                }
            }
            float aspectRatio = this.GraphicsDevice.Viewport.AspectRatio;

            this.WireMesh.Position = this.LogoMesh.Position = new Vector3(0.0f, -num, 0.0f);
            this.FezEffect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float)(10.0 * (double)aspectRatio * (1.0 - (double)num)), (float)(10.0 * (1.0 - (double)num)), 0.1f, 100f));
            if (this.Starfield != null)
            {
                this.Starfield.AdditionalZoom = Easing.EaseInOut((double)num, EasingType.Quadratic);
                this.Starfield.HasZoomed      = true;
            }
            if (this.Inverted || (double)num < 0.999000012874603)
            {
                return;
            }
            this.IsFullscreen = true;
        }
Ejemplo n.º 10
0
    protected override void Delta()
    {
        float ease = Easing.EaseInOut(Mathf.Clamp01(timer / duration), EasingType.Quadratic);

        Vector3 newVec = t.localScale;

        newVec.x     = Mathf.Lerp(fromVec.x, toVec.x, ease);
        newVec.y     = Mathf.Lerp(fromVec.y, toVec.y, ease);
        t.localScale = newVec;
    }
Ejemplo n.º 11
0
 public void SetSFXVol(float fVal)
 {
     GameGlobals.s_fUI_SliderSFX = fVal;
     GameGlobals.s_fVOL_SFX      = (Easing.EaseInOut(1f - fVal, EEasingType.Sine, EEasingType.Sine) * -35f) + Types.s_fVOL_MaxAttenuation;
     if (GameGlobals.s_fVOL_SFX <= -35f)
     {
         GameGlobals.s_fVOL_SFX = Types.s_fVOL_MinAttenuation;
     }
     m_Master.SetFloat("VOL_SFX", GameGlobals.s_fVOL_SFX);
     PlayerPrefs.SetFloat("MasterSfx", GameGlobals.s_fVOL_SFX);
 }
Ejemplo n.º 12
0
 public void SetMusicVol(float fVal)
 {
     GameGlobals.s_fUI_SliderMusic = fVal;
     GameGlobals.s_fVOL_Music      = (Easing.EaseInOut(1f - fVal, EEasingType.Sine, EEasingType.Sine) * -35f) + Types.s_fVOL_MaxAttenuation;
     if (GameGlobals.s_fVOL_Music <= -35f)
     {
         GameGlobals.s_fVOL_Music = Types.s_fVOL_MinAttenuation;
     }
     m_Master.SetFloat("VOL_Music", GameGlobals.s_fVOL_Music);
     PlayerPrefs.SetFloat("MasterMus", GameGlobals.s_fVOL_Music);
 }
Ejemplo n.º 13
0
 private void DoDraw()
 {
     if (this.IsDisposed)
     {
         return;
     }
     if (Fez.LongScreenshot)
     {
         this.TargetRenderer.DrawFullscreen(Color.White);
     }
     if (this.forFrames == 0)
     {
         float amount = 1f - Easing.EaseInOut((double)FezMath.Saturate(this.SinceStarted / 5f), EasingType.Sine);
         this.WireMesh.Scale             = this.LogoMesh.Scale = new Vector3(1f, 1f, 1f);
         this.FezEffect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Lerp(new Vector3(0.0f, 0.0f, 10f), new Vector3(-10f, 10f, 10f), amount), Vector3.Zero, Vector3.Up));
         this.DrawMaskedLogo();
     }
     else
     {
         GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.Red | ColorWriteChannels.Green);
         this.LogoMesh.Scale             = this.glitchScale[0];
         this.LogoMesh.Material.Opacity  = this.glitchOpacity[0];
         this.FezEffect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Lerp(new Vector3(0.0f, 0.0f, 10f), new Vector3(-10f, 10f, 10f), this.glitchTilt[0]), Vector3.Zero, Vector3.Up));
         this.DrawMaskedLogo();
         this.GraphicsDevice.Clear(ClearOptions.Stencil, Color.Black, 0.0f, 0);
         GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.Green | ColorWriteChannels.Blue);
         this.LogoMesh.Scale             = this.glitchScale[1];
         this.LogoMesh.Material.Opacity  = this.glitchOpacity[1];
         this.FezEffect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Lerp(new Vector3(0.0f, 0.0f, 10f), new Vector3(-10f, 10f, 10f), this.glitchTilt[1]), Vector3.Zero, Vector3.Up));
         this.DrawMaskedLogo();
         this.GraphicsDevice.Clear(ClearOptions.Stencil, Color.Black, 0.0f, 0);
         GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.Red | ColorWriteChannels.Blue);
         this.LogoMesh.Scale             = this.glitchScale[2];
         this.LogoMesh.Material.Opacity  = this.glitchOpacity[2];
         this.FezEffect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Lerp(new Vector3(0.0f, 0.0f, 10f), new Vector3(-10f, 10f, 10f), this.glitchTilt[2]), Vector3.Zero, Vector3.Up));
         this.DrawMaskedLogo();
         GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All);
         this.LogoMesh.Material.Opacity = 1f;
         --this.forFrames;
     }
     if (this.LogoTexture != null)
     {
         this.TargetRenderer.DrawFullscreen(this.LogoTexture, new Color(1f, 1f, 1f, this.LogoTextureXFade));
         this.Starfield.Opacity = 1f - this.LogoTextureXFade;
     }
     if (this.InLogoMesh != null)
     {
         this.InLogoMesh.Draw();
     }
     GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None);
     this.WireMesh.Draw();
 }
Ejemplo n.º 14
0
            public void MoveToHeight()
            {
                if (this.MovingToHeight)
                {
                    return;
                }
                this.MovingToHeight = true;
                float y = this.ArtObject.ActorSettings.ShouldMoveToHeight.Value;

                this.ArtObject.ActorSettings.ShouldMoveToHeight = new float?();
                Vector3 vector3     = this.ArtObject.Position + this.CenterOffset;
                Vector3 movement    = (new Vector3(0.0f, y, 0.0f) - vector3) * Vector3.UnitY + Vector3.UnitY / 2f;
                Vector3 origin      = vector3;
                Vector3 destination = vector3 + movement;
                float   lastHeight  = origin.Y;

                if (this.PlayerManager.Action == ActionType.PivotTombstone || this.PlayerManager.Grounded && this.AttachedGroup.Triles.Contains(this.PlayerManager.Ground.First))
                {
                    this.MovingToHeight = false;
                }
                else if ((double)Math.Abs(movement.Y) < 1.0)
                {
                    this.MovingToHeight = false;
                }
                else
                {
                    IWaiter waiter = Waiters.Interpolate((double)Math.Abs(movement.Y / 2f), (Action <float>)(step =>
                    {
                        float local_0           = Easing.EaseInOut((double)step, EasingType.Sine);
                        this.ArtObject.Position = Vector3.Lerp(origin, destination, local_0);
                        this.ArtObject.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, local_0 * 1.570796f * (float)(int)Math.Round((double)movement.Y / 2.0));
                        foreach (TrileInstance item_0 in this.AttachedGroup.Triles)
                        {
                            item_0.Position += Vector3.UnitY * (this.ArtObject.Position.Y - lastHeight);
                            item_0.PhysicsState.Velocity = Vector3.UnitY * (this.ArtObject.Position.Y - lastHeight);
                            this.LevelManager.UpdateInstance(item_0);
                        }
                        lastHeight = this.ArtObject.Position.Y;
                    }), (Action)(() =>
                    {
                        this.ArtObject.Position = destination;
                        this.ArtObject.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f * (float)(int)Math.Round((double)movement.Y / 2.0));
                        foreach (TrileInstance item_1 in this.AttachedGroup.Triles)
                        {
                            item_1.PhysicsState.Velocity = Vector3.Zero;
                        }
                        this.MovingToHeight = false;
                    }));
                    waiter.AutoPause   = true;
                    waiter.UpdateOrder = -2;
                }
            }
Ejemplo n.º 15
0
 public void CreateCloseAnimation()
 {
     CloseAnimation = new Animation()
     {
         DurationInFrames = Animation.FromTimeSpanToDurationInFrames(0.2),
         EasingFunction   = ef => Easing.EaseInOut(ef, EasingType.Quadratic)
     };
     CloseAnimation.AnimateOnControlThread(
         metroPanel1,
         ObservableHelper.FixedValue(menuSize),
         ObservableHelper.FixedValue(0f),
         f => metroPanel1.Size = new Size((int)f.CurrentValue, metroPanel1.Size.Height));
 }
Ejemplo n.º 16
0
 public LongRunningAction TiltOnVertex(int id, float durationSeconds)
 {
     return(new LongRunningAction((Func <float, float, bool>)((_, totalSeconds) =>
     {
         ArtObjectInstance local_0;
         if (!this.LevelManager.ArtObjects.TryGetValue(id, out local_0))
         {
             return true;
         }
         float local_1 = Easing.EaseInOut((double)totalSeconds / (double)durationSeconds, EasingType.Sine);
         local_0.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0)) * FezMath.Saturate(local_1)) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f * FezMath.Saturate(local_1));
         return false;
     })));
 }
Ejemplo n.º 17
0
    void SetAlpha()
    {
        var eased = Easing.EaseInOut(Mathf.Clamp01(Pico.Level.SinceAlive), EasingType.Sine);
        var r     = gameObject.FindChild("Empty-Second Half").renderer;
        var c     = r.material.GetColor("_TintColor");

        r.material.SetColor("_TintColor", new Color(c.r, c.g, c.b, eased * (14 / 255f)));
        r = gameObject.FindChild("Empty-First Half").renderer;
        c = r.material.GetColor("_TintColor");
        r.material.SetColor("_TintColor", new Color(c.r, c.g, c.b, eased * (14 / 255f)));
        r = gameObject.FindChild("CubeInsideout").renderer;
        c = r.material.GetColor("_TintColor");
        r.material.SetColor("_TintColor", new Color(c.r, c.g, c.b, eased * (13 / 255f)));
    }
Ejemplo n.º 18
0
        private void DoMoveUp(TimeSpan elapsed)
        {
            this.SinceStarted += elapsed;
            float amount = Easing.EaseInOut((double)FezMath.Saturate((float)this.SinceStarted.TotalSeconds / 2f), EasingType.Quadratic);
            int   num    = Math.Sign(this.AttachedGroup.Path.Segments[0].Destination.Y);

            this.GlowPlane.Position = Vector3.Lerp(this.PlaneOrigin + Vector3.UnitY * 2f * (float)num, this.PlaneOrigin, amount);
            this.DoorAo.Position    = Vector3.Lerp(this.AoOrigin + Vector3.UnitY * 2f * (float)num, this.AoOrigin, amount);
            if ((double)amount != 1.0)
            {
                return;
            }
            this.MoveUp = false;
        }
Ejemplo n.º 19
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Loading || this.GameState.Paused)
            {
                return;
            }
            float num1 = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if ((double)num1 == 0.0 || (double)this.StepTime == 0.0)
            {
                this.Reset();
            }
            if ((double)this.preWaitTime > 2.0)
            {
                this.StepTime += num1;
                IGameCameraManager cameraManager = this.CameraManager;
                double             num2          = (double)cameraManager.Radius * 1.00499999523163;
                cameraManager.Radius   = (float)num2;
                this.PointsMesh.Scale *= 1.00125f;
            }
            else
            {
                this.StepTime     = 1.0 / 1000.0;
                this.preWaitTime += num1;
            }
            this.CameraManager.SnapInterpolation();
            this.CubesEffect.Emissive        = 1f - Easing.EaseInOut((double)FezMath.Saturate(this.StepTime / 10f), EasingType.Quadratic);
            this.CubesMesh.Material.Opacity  = 1f - Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.StepTime - 23.0) / 3.0)), EasingType.Sine);
            this.PointsMesh.Material.Opacity = 1f - Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.StepTime - 5.0) / 10.0)), EasingType.Sine);
            if (!this.sBluePlayed && (double)this.StepTime > 0.25)
            {
                SoundEffectExtensions.Emit(this.sBlueZoomOut);
                this.sBluePlayed = true;
            }
            if (!this.sProgPlayed && (double)this.StepTime > 7.5)
            {
                SoundEffectExtensions.Emit(this.sProgressiveAppear);
                this.sProgPlayed = true;
            }
            if (!this.sFadePlayed && (double)this.StepTime > 24.0)
            {
                SoundEffectExtensions.Emit(this.sFadeOut);
                this.sFadePlayed = true;
            }
            if ((double)this.StepTime <= 26.0)
            {
                return;
            }
            this.ChangeState();
        }
    // Update is called once per frame
    void Update()
    {
        float fRatio = (Time.time - m_fEventTime) / m_fBounceDuration;

        Vector3 vPos = Vector3.Lerp(m_vStartPos, m_vEndPos, Easing.EaseInOut(fRatio, EasingType.Sine, EasingType.Sine));

        vPos.z = m_gcTransform.position.z;
        m_gcTransform.position = vPos;

        if (fRatio >= 1.0f)
        {
            FlipDirection();
            m_fEventTime = Time.time;
        }
    }
Ejemplo n.º 21
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Loading || this.GameState.Paused)
     {
         return;
     }
     if (!this.Ready)
     {
         this.LateLoadContent();
     }
     this.ScrollMesh.Scale    = new Vector3(96f / (float)this.GraphicsDevice.Viewport.Width, 96f / (float)this.GraphicsDevice.Viewport.Height, 1f) * SettingsManager.GetViewScale(this.GraphicsDevice);
     this.TextGroup.Scale     = !Culture.IsCJK ? new Vector3(1f / SettingsManager.GetViewScale(this.GraphicsDevice)) : new Vector3(1f / SettingsManager.GetViewScale(this.GraphicsDevice)) / 2f;
     this.ScrollMesh.Position = new Vector3(0.01f, this.OnTop ? 0.6125f : -0.6125f, 0.0f);
     if (this.Timeout.HasValue)
     {
         TextScroll textScroll = this;
         float?     timeout    = textScroll.Timeout;
         float      num        = (float)gameTime.ElapsedGameTime.TotalSeconds;
         float?     nullable   = timeout.HasValue ? new float?(timeout.GetValueOrDefault() - num) : new float?();
         textScroll.Timeout = nullable;
         if ((double)this.Timeout.Value <= 0.0)
         {
             SoundEffectExtensions.Emit(this.sClose);
             this.Closing    = true;
             this.Timeout    = new float?();
             this.SinceClose = TimeSpan.Zero;
         }
     }
     if (this.SinceOpen.TotalSeconds < 0.5)
     {
         this.SinceOpen += gameTime.ElapsedGameTime;
         this.OpenOrClose(Easing.EaseInOut(this.SinceOpen.TotalSeconds / 0.5, EasingType.Cubic, EasingType.Sine));
     }
     else
     {
         if (!this.Closing)
         {
             return;
         }
         this.SinceClose += gameTime.ElapsedGameTime;
         this.OpenOrClose(Easing.EaseInOut(1.0 - this.SinceClose.TotalSeconds / 0.5, EasingType.Cubic, EasingType.Sine));
         if (this.SinceClose.TotalSeconds <= 0.5)
         {
             return;
         }
         ServiceHelper.RemoveComponent <TextScroll>(this);
     }
 }
Ejemplo n.º 22
0
    public static IEnumerator FadeObjectRecursive(Transform objectToFade, float alphaFrom, float alphaTo, float time, EasingType ease)
    {
        var t = 0f;

        SetAlphaOnAllChildren(objectToFade, alphaFrom);

        while (t < 1f)
        {
            SetAlphaOnAllChildren(objectToFade, Mathf.Lerp(alphaFrom, alphaTo, Easing.EaseInOut(t, ease)));

            t += Time.deltaTime / time;
            yield return(null);
        }

        SetAlphaOnAllChildren(objectToFade, alphaTo);
    }
Ejemplo n.º 23
0
        public void SlowFocusOn(int id, float duration, float trixPerPix)
        {
            Volume  volume = this.LevelManager.Volumes[id];
            Vector3 center = (volume.From + volume.To) / 2f;

            this.CameraManager.Constrained = true;
            Vector3 c          = this.CameraManager.Center;
            float   currentTpP = this.CameraManager.PixelsPerTrixel;

            Waiters.Interpolate((double)duration, (Action <float>)(s =>
            {
                float local_0 = Easing.EaseInOut((double)s, EasingType.Sine);
                this.CameraManager.PixelsPerTrixel = MathHelper.Lerp(currentTpP, trixPerPix, local_0);
                this.CameraManager.Center          = Vector3.Lerp(c, center - new Vector3(0.0f, 1f, 0.0f), local_0);
            })).AutoPause = true;
        }
Ejemplo n.º 24
0
    IEnumerator SetPivotHandler(Vector2 srcPivot, Vector2 dstPivot)
    {
        float time = 0;

        while (time < TransitionDuration)
        {
            var easedStep = Easing.EaseInOut(time / TransitionDuration, TransitionEasingType);

            CursorTransform.pivot = Vector2.Lerp(srcPivot, dstPivot, easedStep);

            time += Time.deltaTime;
            yield return(null);
        }

        CursorTransform.pivot = dstPivot;
    }
Ejemplo n.º 25
0
    protected void Update()
    {
        if (_animationActive == true)
        {
            Vector3 tmp = Vector3.Lerp(_prevPosition, _nextPosition, Easing.EaseInOutCubic(_lerpPosition));
            tmp.y = Mathf.Sin(_lerpPosition * Mathf.PI) * AnimationJumpHeight;

            transform.position   = tmp;
            transform.localScale = Vector3.one * (0.5f + Mathf.Sin(Easing.EaseInOut(_lerpPosition) * Mathf.PI) * AnimationScaleFactor * 0.5f);

            _lerpPosition += Time.deltaTime * kAnimationsInvMaxLength;
            if (_lerpPosition > 1.0f)
            {
                _lerpPosition = 1.0f;
            }
        }
    }
Ejemplo n.º 26
0
 private static float Ease(float t, EasingType ease = EasingType.Linear, bool easeIn = true, bool easeOut = true)
 {
     t = Mathf.Clamp01(t);
     if (easeIn && easeOut)
     {
         t = Easing.EaseInOut(t, ease);
     }
     else if (easeIn)
     {
         t = Easing.EaseIn(t, ease);
     }
     else if (easeOut)
     {
         t = Easing.EaseOut(t, ease);
     }
     return(t);
 }
Ejemplo n.º 27
0
    void Update()
    {
        if (!m_bIsActive)
        {
            return;
        }

        float fRatio = ((TimerManager.fGameTime - m_fEventTime) / m_fDuration) + m_fOffset;

        transform.position = Vector3.Lerp(v1, v2, Easing.EaseInOut(fRatio, m_iEasing));
        if (fRatio >= 1.0f)
        {
            m_fOffset = 0;
            Vector3 vTemp = v1;
            v1           = v2;
            v2           = vTemp;
            m_fEventTime = TimerManager.fGameTime;
        }
    }
Ejemplo n.º 28
0
    public static float getEasingValue(float timeStep, string easingMethod, EasingType easingType)
    {
        switch (easingMethod)
        {
        case MiniTweenEasingType.EaseIn:
            timeStep = Easing.EaseIn(timeStep, easingType);
            break;

        case MiniTweenEasingType.EaseInOut:
            timeStep = Easing.EaseInOut(timeStep, easingType);
            break;

        case MiniTweenEasingType.EaseOut:
            timeStep = Easing.EaseOut(timeStep, easingType);
            break;
        }

        return(timeStep);
    }
Ejemplo n.º 29
0
    IEnumerator FitHandler(RectContent[] contents)
    {
        float time = 0;

        while (time < TransitionDuration)
        {
            var easedStep = Easing.EaseInOut(time / TransitionDuration, TransitionEasingType);

            if (EaseSize)
            {
                trans.sizeDelta = Vector2.Lerp(originalSize, targetSize, easedStep);
            }
            for (int i = 0; i < contents.Length; i++)
            {
                if (!contents[i].Controllable)
                {
                    continue;
                }

                contents[i].CurrentPosition = Vector2.Lerp(
                    contents[i].OriginalPosition,
                    contents[i].TargetPosition, easedStep);
            }

            time += Time.deltaTime;
            yield return(null);
        }

        if (EaseSize)
        {
            trans.sizeDelta = targetSize;
        }
        for (int i = 0; i < contents.Length; i++)
        {
            if (!contents[i].Controllable)
            {
                continue;
            }

            contents[i].CurrentPosition = contents[i].TargetPosition;
        }
    }
Ejemplo n.º 30
0
    void Update()
    {
        sinceStarted += Time.deltaTime;

        var step      = Mathf.Clamp01(sinceStarted / 3);
        var easedStep = Easing.EaseInOut(Easing.EaseOut(step, EasingType.Quintic), EasingType.Quadratic);

        var opacity = easedStep;

        foreach (var r in GetComponentsInChildren <Renderer>())
        {
            var c = r.material.color;
            r.material.color = new Color(c.r, c.g, c.b, opacity);
        }

        if (GameFlow.State != GameState.Lost)
        {
            Destroy(gameObject);
        }
    }