EaseIn() public static method

public static EaseIn ( double linearStep, EasingType type ) : float
linearStep double
type EasingType
return float
Esempio n. 1
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (!this.IsActionAllowed(this.PlayerManager.Action))
            {
                return;
            }
            if (this.rgbPlanes != null && this.Phase <= GateWarp.Phases.Decelerate)
            {
                GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None);
                int   num    = 1;
                float amount = 0.01f;
                for (int index = 0; index < 3; ++index)
                {
                    this.rgbPlanes.Groups[index].Material.Diffuse = Vector3.Lerp(this.rgbPlanes.Groups[index].Material.Diffuse, new Vector3(index == 0 ? (float)num : 0.0f, index == 1 ? (float)num : 0.0f, index == 2 ? (float)num : 0.0f), amount);
                    this.rgbPlanes.Groups[index].Material.Opacity = MathHelper.Lerp(this.rgbPlanes.Groups[index].Material.Opacity, (float)num, amount);
                }
                this.rgbPlanes.Draw();
            }
            if (this.Phase != GateWarp.Phases.FadeOut && this.Phase != GateWarp.Phases.FadeIn && this.Phase != GateWarp.Phases.LevelChange)
            {
                return;
            }
            double linearStep = this.SinceStarted.TotalSeconds / 2.25;

            if (this.Phase == GateWarp.Phases.FadeIn)
            {
                linearStep = 1.0 - linearStep;
            }
            float alpha = FezMath.Saturate(Easing.EaseIn(linearStep, EasingType.Cubic));

            GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None);
            this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha));
        }
Esempio n. 2
0
 protected override bool Act(TimeSpan elapsed)
 {
     if (!this.PlayerManager.CanControl)
     {
         return(true);
     }
     if (this.fade == null && this.sinceHurt.TotalSeconds > (this.doneFor ? 1.25 : 1.0))
     {
         this.sinceHurt         = TimeSpan.Zero;
         this.causedByHurtActor = false;
         if (this.doneFor)
         {
             this.fade = new ScreenFade(ServiceHelper.Game)
             {
                 FromColor = ColorEx.TransparentBlack,
                 ToColor   = Color.Black,
                 Duration  = 1f
             };
             ServiceHelper.AddComponent((IGameComponent)this.fade);
             this.fade.Faded += new Action(this.Respawn);
         }
         else
         {
             this.PlayerManager.Action = ActionType.Idle;
         }
     }
     else
     {
         this.sinceHurt += elapsed;
         this.PlayerManager.BlinkSpeed = Easing.EaseIn(this.sinceHurt.TotalSeconds / 1.25, EasingType.Cubic) * 1.5f;
     }
     return(true);
 }
Esempio n. 3
0
        private void UpdateRays(float elapsedSeconds)
        {
            bool flag = (double)this.PhaseTime > 1.5;

            this.MakeRay();
            if (flag)
            {
                this.MakeRay();
            }
            for (int i = this.RaysMesh.Groups.Count - 1; i >= 0; --i)
            {
                Group            group    = this.RaysMesh.Groups[i];
                DotHost.RayState rayState = group.CustomData as DotHost.RayState;
                rayState.Age          += elapsedSeconds * 0.15f;
                group.Material.Diffuse = Vector3.One * FezMath.Saturate(rayState.Age * 8f);
                group.Scale           *= new Vector3(1.5f, 1f, 1f);
                if ((double)rayState.Age > 1.0)
                {
                    this.RaysMesh.RemoveGroupAt(i);
                }
            }
            this.RaysMesh.AlwaysOnTop       = false;
            this.FlareMesh.Position         = this.RaysMesh.Position = TempleOfLoveHost.HeartCenter;
            this.FlareMesh.Rotation         = this.RaysMesh.Rotation = this.CameraManager.Rotation;
            this.FlareMesh.Material.Opacity = Easing.EaseIn((double)FezMath.Saturate(this.PhaseTime / 2.5f), EasingType.Cubic);
            this.FlareMesh.Scale            = Vector3.One + this.RaysMesh.Scale * Easing.EaseIn(((double)this.PhaseTime - 0.25) / 1.75, EasingType.Decic) * 4f;
        }
Esempio n. 4
0
 protected override bool Act(TimeSpan elapsed)
 {
     this.sinceStarted += elapsed;
     if (this.fade == null && this.sinceStarted.TotalSeconds > (this.doneFor ? 1.25 : 2.0))
     {
         if (this.doneFor)
         {
             this.fade = new ScreenFade(ServiceHelper.Game)
             {
                 FromColor = ColorEx.TransparentBlack,
                 ToColor   = Color.Black,
                 Duration  = 1f
             };
             ServiceHelper.AddComponent((IGameComponent)this.fade);
             this.fade.Faded += new Action(this.Respawn);
         }
         else
         {
             this.PlayerManager.Respawn();
         }
     }
     else
     {
         this.PlayerManager.BlinkSpeed = Easing.EaseIn(this.sinceStarted.TotalSeconds / (this.doneFor ? 1.25 : 2.0), EasingType.Cubic) * 1.5f;
     }
     return(true);
 }
Esempio n. 5
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Loading || this.GameState.Paused || (this.GameState.InMap || this.GameState.InMenuCube))
     {
         return;
     }
     this.SinceStarted += (float)gameTime.ElapsedGameTime.TotalSeconds;
     if ((double)this.SinceStarted > 8.0 && (double)this.SinceStarted < 19.0)
     {
         this.SpinSpeed = Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.SinceStarted - 8.0) / 5.0)), EasingType.Sine) * 0.005f;
     }
     else if ((double)this.SinceStarted > 19.0)
     {
         this.SpinSpeed = (float)(0.00499999988824129 + (double)Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.SinceStarted - 19.0) / 20.0)), EasingType.Quadratic) * 0.5);
     }
     if ((double)this.SinceStarted > 33.0 && this.Rings != null)
     {
         this.TrialTimeAccumulator += (float)gameTime.ElapsedGameTime.TotalSeconds;
         this.UpdateRays((float)gameTime.ElapsedGameTime.TotalSeconds);
     }
     if (this.Rings == null)
     {
         return;
     }
     this.Rings[0].Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, this.SpinSpeed) * this.Rings[0].Rotation;
     this.Rings[1].Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, this.SpinSpeed) * this.Rings[1].Rotation;
     this.Rings[2].Rotation = Quaternion.CreateFromAxisAngle(Vector3.Left, this.SpinSpeed) * this.Rings[2].Rotation;
     this.Rings[3].Rotation = Quaternion.CreateFromAxisAngle(Vector3.Down, this.SpinSpeed) * this.Rings[3].Rotation;
 }
Esempio n. 6
0
    protected override void Update()
    {
        // If there's a pause defined, wait before doing the actual lerp...
        if (!m_bIsUpdating)
        {
            if (Time.time - m_fEventTime > m_fSecondsDelayBeforeStarting)
            {
                m_bIsUpdating = true;
                Init();
            }
            else
            {
                return;
            }
        }


        float fRatio = (Time.time - m_fEventTime) / m_fDurationInSeconds;

        switch (m_iEasingEnds)
        {
        case EEasingEnds._In: m_vColour.a = Mathf.Lerp(m_fStartAlpha, m_fEndAlpha, Easing.EaseIn(fRatio, m_iEasingType)); break;

        case EEasingEnds._InOut: m_vColour.a = Mathf.Lerp(m_fStartAlpha, m_fEndAlpha, Easing.EaseInOut(fRatio, m_iEasingType)); break;

        case EEasingEnds._Out: m_vColour.a = Mathf.Lerp(m_fStartAlpha, m_fEndAlpha, Easing.EaseOut(fRatio, m_iEasingType)); break;
        }

        m_gcRenderer.color = m_vColour;

        if (fRatio >= 1.0f)
        {
            Destroy(this);
        }
    }
Esempio n. 7
0
    protected virtual void CalculateSpeed()
    {
        float currentDistance = Vector3.Distance(this.transform.position, this.points[this.currentIndex]);
        float totalDistance   = Vector3.Distance(this.points[this.currentIndex], this.points[this.nextIndex]);

        if (currentDistance / totalDistance < this.speedUpPercentage)
        {
            float lerpPercentage = currentDistance / (totalDistance * this.speedUpPercentage);

            if (this.useEasing)
            {
                lerpPercentage = Easing.EaseOut(lerpPercentage, EasingType.Quadratic);
            }

            this.currentSpeed = Mathf.Lerp(this.minSpeed, this.maxSpeed, lerpPercentage);
            this.currentSpeed = Mathf.Max(this.currentSpeed, this.impulseSpeed);
        }
        else if (currentDistance / totalDistance > this.slowDownPercentage)
        {
            float slowDownDistance = totalDistance * this.slowDownPercentage;
            float lerpPercentage   = (currentDistance - slowDownDistance) / (totalDistance - slowDownDistance);

            if (this.useEasing)
            {
                lerpPercentage = Easing.EaseIn(lerpPercentage, EasingType.Cubic);
            }

            this.currentSpeed = Mathf.Lerp(this.maxSpeed, this.minSpeed, lerpPercentage);
        }
        else
        {
            this.currentSpeed = this.maxSpeed;
        }
    }
Esempio n. 8
0
    void Update()
    {
        animTimer += Time.deltaTime;

        if (animTimer > 1)
        {
            animTimer  -= 1f;
            clickyState = !clickyState;
        }

        if (clickyState)
        {
            iconTimer2 += Time.deltaTime;
            if (iconTimer2 > 0.15)
            {
                iconTimer2  -= 0.15f;
                clickyState2 = !clickyState2;
            }
        }

        iconTimer       += Time.deltaTime;
        ReturnIcon.color = new Color(1.0f, 1.0f, 1.0f, Easing.EaseIn(Mathf.Clamp01((iconTimer - 2.0f) * 5.0f), EasingType.Quintic));

        ClickyAvatar.sprite = clickyState2 ? ClickySprites[0] : ClickySprites[1];
    }
Esempio n. 9
0
        public override void Update(GameTime gameTime)
        {
            if (this.ReverseTiming)
            {
                this.sinceStarted -= gameTime.ElapsedGameTime;
                this.sinceStarted -= gameTime.ElapsedGameTime;
            }
            else
            {
                this.sinceStarted += gameTime.ElapsedGameTime;
            }
            float num = Easing.EaseIn(this.sinceStarted.TotalSeconds / 3.0, EasingType.Quartic);

            if (this.HasHorizontalTrails)
            {
                (this.TrailsMesh.Effect as HorizontalTrailsEffect).Timing = (float)this.sinceStarted.TotalSeconds;
            }
            if (!this.FollowCamera)
            {
                this.AdditionalZoom  = (float)FezMath.AsNumeric(this.HasZoomed) + num / 3f;
                this.AdditionalScale = num / 6f;
            }
            if (!this.HasHorizontalTrails && (double)num > 40.0 && !this.Done)
            {
                this.Done = true;
                ServiceHelper.RemoveComponent <StarField>(this);
            }
            if (!this.HasHorizontalTrails || !(this.sinceStarted <= TimeSpan.Zero))
            {
                return;
            }
            this.Enabled      = false;
            this.sinceStarted = TimeSpan.Zero;
        }
Esempio n. 10
0
    void Update()
    {
        if (!active)
        {
            return;
        }

        sinceStarted += Time.deltaTime;

        forTransform.localScale = Vector3.Lerp(fromScale, scaleDestination,
                                               inverse
                    ? Easing.EaseOut(Mathf.Clamp01(sinceStarted / TransitionOver), EasingType.Quartic)
                : Easing.EaseIn(Mathf.Clamp01(sinceStarted / TransitionOver), EasingType.Quartic));

        if (sinceStarted >= TransitionOver)
        {
            active = false;
            if (OnComplete != null)
            {
                var oc = OnComplete;
                OnComplete = null;
                oc();
            }
        }
    }
Esempio n. 11
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;
 }
Esempio n. 12
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Loading)
     {
         return;
     }
     if (FezMath.AlmostEqual(this.PlayerManager.Velocity.Y, 0.0f))
     {
         if (this.eFall != null && !this.eFall.Dead)
         {
             this.eFall.FadeOutAndDie(0.1f);
             this.eFall = (SoundEmitter)null;
         }
     }
     else
     {
         if (this.eFall == null || this.eFall.Dead)
         {
             this.eFall = SoundEffectExtensions.EmitAt(this.sFall, this.PlayerManager.Position, true, 0.0f, 0.0f);
         }
         this.eFall.Position     = this.PlayerManager.Position;
         this.eFall.VolumeFactor = Easing.EaseIn((double)FezMath.Saturate((float)(-(double)this.PlayerManager.Velocity.Y / 0.400000005960464)), EasingType.Quadratic);
     }
     base.Update(gameTime);
 }
Esempio n. 13
0
    void FixedUpdate()
    {
        if (Dead)
        {
            return;
        }

        BeforeUpdate();

        SinceAlive += Time.deltaTime;

        if (LockedTo == null || LockedTo.Dead)
        {
            TryLock();
        }

        if (LockedTo != null) // Still no-one?
        {
            var   heading = Vector3.Normalize(LockedTo.transform.position - transform.position);
            float headingSpeed;
            if (SinceAlive < 1.25f)
            {
                headingSpeed = Easing.EaseIn(SinceAlive / 1.25f, EasingType.Quadratic) * 0.225f;
            }
            else
            {
                headingSpeed = 0.225f + 0.1f * Mathf.Clamp01(SinceAlive - 1.25f);
            }

            Direction          = Vector3.Slerp(Direction, heading, headingSpeed);
            transform.rotation = Quaternion.LookRotation(Direction);

            // test for infinite loop around dude
            if (Vector3.Distance(transform.position, LockedTo.transform.position) < 2.0f)
            {
                SinceVeryClose += Time.deltaTime;
                if (SinceVeryClose > 1.5f)
                {
                    // fake force collide
                    OnCollide(LockedTo.collider, transform.position);
                    return;
                }
            }
            else
            {
                SinceVeryClose = 0;
            }
        }

        var speed = Mathf.Lerp(5, TerminalSpeed, Easing.EaseIn(Mathf.Clamp01(SinceAlive * 1.25f), EasingType.Quintic));

        transform.position += Time.deltaTime * speed * Direction;

        // Trail!
        SpawnAt(transform.position);
        SpawnAt((transform.position + LastPosition) / 2f);

        AfterUpdate();
    }
Esempio n. 14
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Loading || this.GameState.Paused)
            {
                return;
            }
            this.Time += (float)gameTime.ElapsedGameTime.TotalSeconds;
            switch (this.ActiveState)
            {
            case AxisDna.State.AxisZoom:
                if ((double)this.Time == 0.0)
                {
                    this.CameraManager.Center    = Vector3.Zero;
                    this.CameraManager.Direction = Vector3.UnitZ;
                    this.CameraManager.Radius    = 10f;
                    this.CameraManager.SnapInterpolation();
                    this.LevelManager.ActualAmbient = new Color(0.25f, 0.25f, 0.25f);
                    this.LevelManager.ActualDiffuse = Color.White;
                    this.NoiseMesh.Scale            = Vector3.One;
                }
                float num = FezMath.Saturate(this.Time / 10f);
                this.CameraManager.Direction      = FezMath.Slerp(Vector3.UnitZ, -Vector3.Transform(Vector3.UnitZ, this.HelixMesh.Rotation), num * 0.5f);
                this.FatAxisMesh.Material.Opacity = 1f - Easing.EaseIn((double)FezMath.Saturate(num * 2f), EasingType.Quadratic);
                if ((double)this.Time != 0.0)
                {
                    this.FatAxisMesh.Scale *= MathHelper.Lerp(1.015f, 1.01f, Easing.EaseIn((double)num, EasingType.Quadratic));
                }
                this.HelixMesh.Scale      = this.FatAxisMesh.Scale;
                this.CameraManager.Center = new Vector3(0.0f, this.FatAxisMesh.Scale.X / 1000f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.HelixMesh.Rotation         = this.HelixMesh.Rotation * Quaternion.CreateFromAxisAngle(Vector3.UnitZ, Easing.EaseOut(0.0149999996647239 * (1.0 - (double)num), EasingType.Cubic));
                this.NoiseMesh.Material.Opacity = Easing.EaseIn((double)num, EasingType.Cubic);
                this.NoiseMesh.Scale           *= 1.0001f;
                if ((double)num != 1.0)
                {
                    break;
                }
                this.ChangeState();
                break;

            case AxisDna.State.StrandZoom:
                float amount = FezMath.Saturate(this.Time / 7.42f);
                if ((double)this.Time != 0.0 && (double)amount != 1.0)
                {
                    this.HelixMesh.Scale *= 1.01f;
                }
                this.HelixMesh.Position   = (float)(((double)this.HelixMesh.Scale.X - 7400.0) / 1000.0) * this.CameraManager.Direction;
                this.CameraManager.Center = Vector3.Lerp(new Vector3(0.0f, this.HelixMesh.Scale.X / 1000f, 0.0f), new Vector3((float)(-(double)this.HelixMesh.Scale.X / 90000.0), this.HelixMesh.Scale.X / 1100f, 0.0f), amount);
                this.CameraManager.SnapInterpolation();
                this.NoiseMesh.Scale            *= MathHelper.Lerp(1.0001f, 1.0025f, amount);
                this.ShimmeringEffect.Saturation = (float)(1.0 - (double)amount * 0.5);
                if ((double)amount != 1.0)
                {
                    break;
                }
                this.ChangeState();
                break;
            }
        }
Esempio n. 15
0
 private void UpdateRays(float elapsedSeconds)
 {
     if (this.TrialRaysMesh.Groups.Count < 50 && RandomHelper.Probability(0.2))
     {
         float x     = 6f + RandomHelper.Centered(4.0);
         float num   = RandomHelper.Between(0.5, (double)x / 2.5);
         Group group = this.TrialRaysMesh.AddGroup();
         group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <FezVertexPositionTexture>(new FezVertexPositionTexture[6]
         {
             new FezVertexPositionTexture(new Vector3(0.0f, (float)((double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 0.0f)),
             new FezVertexPositionTexture(new Vector3(x, num / 2f, 0.0f), new Vector2(1f, 0.0f)),
             new FezVertexPositionTexture(new Vector3(x, (float)((double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.45f)),
             new FezVertexPositionTexture(new Vector3(x, (float)(-(double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.55f)),
             new FezVertexPositionTexture(new Vector3(x, (float)(-(double)num / 2.0), 0.0f), new Vector2(1f, 1f)),
             new FezVertexPositionTexture(new Vector3(0.0f, (float)(-(double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 1f))
         }, new int[12]
         {
             0,
             1,
             2,
             0,
             2,
             5,
             5,
             2,
             3,
             5,
             3,
             4
         }, PrimitiveType.TriangleList);
         group.CustomData = (object)new DotHost.RayState();
         group.Material   = new Material()
         {
             Diffuse = new Vector3(0.0f)
         };
         group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Forward, RandomHelper.Between(0.0, 6.28318548202515));
     }
     for (int i = this.TrialRaysMesh.Groups.Count - 1; i >= 0; --i)
     {
         Group            group    = this.TrialRaysMesh.Groups[i];
         DotHost.RayState rayState = group.CustomData as DotHost.RayState;
         rayState.Age += elapsedSeconds * 0.15f;
         float num1 = Easing.EaseOut((double)Easing.EaseOut(Math.Sin((double)rayState.Age * 6.28318548202515 - 1.57079637050629) * 0.5 + 0.5, EasingType.Quintic), EasingType.Quintic);
         group.Material.Diffuse = Vector3.Lerp(Vector3.One, rayState.Tint.ToVector3(), 0.05f) * 0.15f * num1;
         float num2 = rayState.Speed;
         group.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward, (float)((double)elapsedSeconds * (double)num2 * (0.100000001490116 + (double)Easing.EaseIn((double)this.TrialTimeAccumulator / 3.0, EasingType.Quadratic) * 0.200000002980232)));
         group.Scale     = new Vector3((float)((double)num1 * 0.75 + 0.25), (float)((double)num1 * 0.5 + 0.5), 1f);
         if ((double)rayState.Age > 1.0)
         {
             this.TrialRaysMesh.RemoveGroupAt(i);
         }
     }
     this.TrialFlareMesh.Position         = this.TrialRaysMesh.Position = this.Rings[0].Position;
     this.TrialFlareMesh.Rotation         = this.TrialRaysMesh.Rotation = this.CameraManager.Rotation;
     this.TrialRaysMesh.Scale             = new Vector3(Easing.EaseIn((double)this.TrialTimeAccumulator / 2.0, EasingType.Quadratic) + 1f);
     this.TrialFlareMesh.Material.Opacity = (float)(0.125 + (double)Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.TrialTimeAccumulator - 2.0) / 3.0)), EasingType.Cubic) * 0.875);
     this.TrialFlareMesh.Scale            = Vector3.One + this.TrialRaysMesh.Scale * Easing.EaseIn((double)Math.Max(this.TrialTimeAccumulator - 2.5f, 0.0f) / 1.5, EasingType.Cubic) * 4f;
 }
Esempio n. 16
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;
        }
Esempio n. 17
0
 private void OpenOrClose(float step)
 {
     this.ScrollMesh.Material.Opacity = FezMath.Saturate(step / 0.4f);
     this.LeftPart.Position           = Vector3.Lerp(new Vector3(-1f, 0.0f, 0.0f), new Vector3((float)(-(double)this.MiddlePartSize.X / 16.0 / 2.0 - 1.0), 0.0f, 0.0f), step);
     this.RightPart.Position          = Vector3.Lerp(new Vector3(1f, 0.0f, 0.0f), new Vector3((float)((double)this.MiddlePartSize.X / 16.0 / 2.0 + 1.0), 0.0f, 0.0f), step);
     this.MiddlePart.Scale            = Vector3.Lerp(new Vector3(0.0f, 1f, 1f), new Vector3((float)(((double)this.MiddlePartSize.X + 1.0) / 16.0), 1f, 1f), step);
     this.MiddlePart.TextureMatrix.Set(new Matrix?(new Matrix(MathHelper.Lerp(0.0f, this.MiddlePartSize.X / 32f, step), 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f)));
     this.TextGroup.Material.Opacity = Easing.EaseIn((double)FezMath.Saturate((float)(((double)step - 0.75) / 0.25)), EasingType.Quadratic);
 }
Esempio n. 18
0
    protected override void Delta()
    {
        float ease = Easing.EaseIn(Mathf.Clamp01(timer / duration), EasingType.Quadratic);

        Color col = spriteRenderer.color;

        col.a = Mathf.Lerp(fromVec.w, toVec.w, ease);
        spriteRenderer.color = col;
    }
Esempio n. 19
0
    protected override void Delta()
    {
        float ease = Easing.EaseIn(Mathf.Clamp01(timer / duration), EasingType.Quadratic);

        Vector3 newVec = t.localPosition;

        newVec.x        = Mathf.Lerp(fromVec.x, toVec.x, ease);
        newVec.y        = Mathf.Lerp(fromVec.y, toVec.y, ease);
        t.localPosition = newVec;
    }
Esempio n. 20
0
        protected override void DollyZoom()
        {
            float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice);

            if (!this.GameState.InFpsMode)
            {
                base.DollyZoom();
            }
            else
            {
                bool  flag   = FezMath.IsOrthographic(this.viewpoint);
                float amount = (double)this.directionTransition.TotalStep == 0.0 ? 1.0 / 1000.0 : this.directionTransition.TotalStep;
                float num1   = MathHelper.Lerp(flag ? GameCameraManager.FirstPersonFov : 0.0f, flag ? 0.0f : GameCameraManager.FirstPersonFov, amount);
                float num2   = this.radiusBeforeTransition;
                if (this.DollyZoomOut)
                {
                    num2 = this.radiusBeforeTransition + (float)((1.0 - (double)Easing.EaseIn((double)amount, EasingType.Quadratic)) * 15.0);
                }
                float num3 = (float)((double)num2 / (double)this.AspectRatio / (2.0 * Math.Tan((double)num1 / 2.0))) / viewScale;
                if (this.directionTransition.Reached)
                {
                    this.ProjectionTransition = false;
                    if (!flag)
                    {
                        this.predefinedViews[this.lastViewpoint].Direction = -FezMath.ForwardVector(this.lastViewpoint);
                        this.current.Radius = 0.1f;
                    }
                    else
                    {
                        this.current.Radius      = this.radiusBeforeTransition;
                        this.NearPlane           = 0.1f;
                        this.FarPlane            = 500f;
                        this.GameState.InFpsMode = false;
                    }
                    this.FogManager.Density = this.LevelManager.Sky == null ? 0.0f : this.LevelManager.Sky.FogDensity;
                    this.DollyZoomOut       = false;
                    this.RebuildProjection();
                    this.SnapInterpolation();
                }
                else
                {
                    this.FogManager.Density = (this.LevelManager.Sky == null ? 0.0f : this.LevelManager.Sky.FogDensity) * Easing.EaseIn(flag ? 1.0 - (double)amount : (double)amount, EasingType.Quadratic);
                    float num4 = (float)((double)num3 * (flag ? (double)amount : 1.0 - (double)amount) + 0.100000001490116);
                    this.NearPlane   = Math.Max(0.1f, 0.1f + num4 - num2);
                    this.FarPlane    = Math.Max(num4 + this.NearPlane, 499.9f);
                    this.FieldOfView = num1;
                    this.projection  = Matrix.CreatePerspectiveFieldOfView(this.FieldOfView, this.AspectRatio, this.NearPlane, this.FarPlane);
                    this.OnProjectionChanged();
                    this.current.Radius = num4;
                    this.view           = Matrix.CreateLookAt(this.current.Radius * this.current.Direction + this.current.Center, this.current.Center, Vector3.UnitY);
                    this.OnViewChanged();
                }
            }
        }
Esempio n. 21
0
 public override void Draw(GameTime gameTime)
 {
     if ((double)this.planeOpacity == 0.0 || Fez.LongScreenshot)
     {
         return;
     }
     this.mesh.Material.Opacity    = this.planeOpacity;
     this.mesh.FirstGroup.Position = new Vector3(0.0f, (float)(1.75 * (double)Easing.EaseIn((double)this.sinceLoadingVisible, EasingType.Quadratic) * (this.GameState.DotLoading ? 0.0 : 1.0)), 0.0f);
     this.mesh.FirstGroup.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, (float)(-gameTime.ElapsedGameTime.TotalSeconds * 3.0)) * this.mesh.FirstGroup.Rotation;
     this.mesh.Draw();
 }
Esempio n. 22
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Paused || this.GameState.Loading)
            {
                return;
            }
            this.Time += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (this.ActiveState != TetraordialOoze.State.Zoom)
            {
                return;
            }
            if ((double)this.Time == 0.0)
            {
                this.CameraManager.Center    = Vector3.Zero;
                this.CameraManager.Direction = Vector3.UnitZ;
                this.CameraManager.Radius    = 10f;
                this.CameraManager.SnapInterpolation();
            }
            if ((double)this.Time == 0.0)
            {
                this.NoiseMesh.Scale = new Vector3(1.87495f);
                this.TetraMesh.Scale = Vector3.One;
            }
            for (int index = 0; index < this.TetraMesh.Groups.Count / 10; ++index)
            {
                this.SwapTetraminos();
            }
            if (this.TetraMesh.Groups.Count < 10 && RandomHelper.Probability(0.100000001490116))
            {
                this.SwapTetraminos();
            }
            float amount = FezMath.Saturate(this.Time / 14f);

            if ((double)amount != 1.0)
            {
                this.NoiseMesh.Scale *= MathHelper.Lerp(1.0025f, 1.01625f, amount);
                IGameCameraManager cameraManager = this.CameraManager;
                double             num           = (double)cameraManager.Radius / (double)MathHelper.Lerp(1.0025f, 1.01625f, amount);
                cameraManager.Radius = (float)num;
                this.CameraManager.SnapInterpolation();
            }
            float num1 = MathHelper.Lerp(0.0f, 1f, Easing.EaseIn((double)FezMath.Saturate(amount * 4f), EasingType.Linear));

            foreach (Group group in this.TetraMesh.Groups)
            {
                group.Material.Opacity = num1;
            }
            this.NoiseMesh.Material.Opacity = 1f - FezMath.Saturate(amount * 1.5f);
            if ((double)amount != 1.0)
            {
                return;
            }
            this.ChangeState();
        }
Esempio n. 23
0
        public override void Draw(GameTime gameTime)
        {
            if (this.GameState.Loading || !this.IsActionAllowed(this.PlayerManager.Action))
            {
                return;
            }
            if (this.Phase != LesserWarp.Phases.LevelChange && this.Phase != LesserWarp.Phases.FadeIn)
            {
                GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None);
                GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.WarpGate));
                this.MaskMesh.Draw();
                GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All);
                GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.WarpGate);
                float  viewScale     = SettingsManager.GetViewScale(this.GraphicsDevice);
                float  m11           = this.CameraManager.Radius / ((float)this.StarTexture.Width / 16f) / viewScale;
                float  m22           = (float)((double)this.CameraManager.Radius / (double)this.CameraManager.AspectRatio / ((double)this.StarTexture.Height / 16.0)) / viewScale;
                Matrix textureMatrix = new Matrix(m11, 0.0f, 0.0f, 0.0f, 0.0f, m22, 0.0f, 0.0f, (float)(-(double)m11 / 2.0), (float)(-(double)m22 / 2.0), 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f);
                this.GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
                this.TargetRenderer.DrawFullscreen((Texture)this.StarTexture, textureMatrix);
                GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None));
            }
            if (this.rgbPlanes != null && this.Phase <= LesserWarp.Phases.Decelerate)
            {
                GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None);
                float num    = (float)((this.Phase == LesserWarp.Phases.Lower || this.Phase == LesserWarp.Phases.Rise ? (double)this.RiseStep : 1.0) * (1.0 - (double)this.LevelManager.ActualDiffuse.R / 512.0) * 0.800000011920929);
                float amount = this.Phase == LesserWarp.Phases.Decelerate || this.Phase == LesserWarp.Phases.Lower || this.Phase == LesserWarp.Phases.FadeOut ? 1f : 0.01f;
                if (this.Phase == LesserWarp.Phases.Accelerate)
                {
                    num = 1f;
                }
                for (int index = 0; index < 3; ++index)
                {
                    this.rgbPlanes.Groups[index].Material.Diffuse = Vector3.Lerp(this.rgbPlanes.Groups[index].Material.Diffuse, new Vector3(index == 0 ? num : 0.0f, index == 1 ? num : 0.0f, index == 2 ? num : 0.0f), amount);
                    this.rgbPlanes.Groups[index].Material.Opacity = MathHelper.Lerp(this.rgbPlanes.Groups[index].Material.Opacity, num, amount);
                }
                this.rgbPlanes.Draw();
            }
            if (this.Phase != LesserWarp.Phases.FadeOut && this.Phase != LesserWarp.Phases.FadeIn && this.Phase != LesserWarp.Phases.LevelChange)
            {
                return;
            }
            double linearStep = this.SinceStarted.TotalSeconds / 2.5;

            if (this.Phase == LesserWarp.Phases.FadeIn)
            {
                linearStep = 1.0 - linearStep;
            }
            float alpha = FezMath.Saturate(Easing.EaseIn(linearStep, EasingType.Cubic));

            GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None);
            this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha));
        }
Esempio n. 24
0
 public override void Draw(GameTime gameTime)
 {
     if (this.ActiveState == Pixelizer.State.Wait || this.GameState.Loading)
     {
         return;
     }
     if (this.GameState.Paused)
     {
         if (!this.TargetRenderer.IsHooked(this.LowResRT))
         {
             return;
         }
         this.TargetRenderer.Resolve(this.LowResRT, true);
         this.GraphicsDevice.Clear(Color.Black);
         SettingsManager.SetupViewport(this.GraphicsDevice, false);
         this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
         GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Opaque);
         this.TargetRenderer.DrawFullscreen((Texture)this.LowResRT);
         GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending);
     }
     else
     {
         GraphicsDevice graphicsDevice = this.GraphicsDevice;
         GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.NotEqual, StencilMask.Gomez);
         Vector3 vector3 = EndCutscene32Host.PurpleBlack.ToVector3();
         GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Alphablending);
         this.TargetRenderer.DrawFullscreen(new Color(vector3.X, vector3.Y, vector3.Z, Easing.EaseIn((double)Easing.EaseOut((double)FezMath.Saturate(this.TotalTime / 57f), EasingType.Sine), EasingType.Quartic)));
         GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Always, StencilMask.None);
         this.SoundManager.SoundEffectVolume = 1f - Easing.EaseIn((double)FezMath.Saturate(this.TotalTime / 57f), EasingType.Quadratic);
         if ((double)this.TotalTime > 54.0 && (double)this.TotalTime < 57.0)
         {
             this.PlayerManager.Hidden = true;
             this.GoMesh.Draw();
         }
         if (this.TargetRenderer.IsHooked(this.LowResRT))
         {
             this.TargetRenderer.Resolve(this.LowResRT, true);
             this.GraphicsDevice.Clear(Color.Black);
             SettingsManager.SetupViewport(this.GraphicsDevice, false);
             this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
             GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Opaque);
             this.TargetRenderer.DrawFullscreen((Texture)this.LowResRT);
             GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Alphablending);
         }
         if ((double)this.TotalTime <= 57.0)
         {
             return;
         }
         this.PlayerManager.Hidden = true;
         this.GoMesh.Draw();
     }
 }
Esempio n. 25
0
    private void DeltaFloatAndFade()
    {
        float ease = Easing.EaseIn(Mathf.Clamp01(timer / duration), EasingType.Quadratic);

        Vector3 position = transform.localPosition;

        position.y = initialY + Mathf.Lerp(0, floatDistance, ease);
        transform.localPosition = position;

        float alpha = Mathf.Lerp(1, 0, ease);

        text.color = new Color(text.color.r, text.color.g, text.color.b, alpha);
    }
Esempio n. 26
0
        public override void Draw(GameTime gameTime)
        {
            double linearStep = this.SinceStarted.TotalSeconds / 1.25;

            if (this.Phase == LevelTransition.Phases.FadeIn)
            {
                linearStep = 1.0 - linearStep;
            }
            float alpha = FezMath.Saturate(Easing.EaseIn(linearStep, EasingType.Cubic));

            GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None);
            this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha));
        }
Esempio n. 27
0
            private void ColorSegments()
            {
                int num1 = this.TrailVertices.Length / 6;

                for (int index1 = 0; index1 < num1; ++index1)
                {
                    for (int index2 = 0; index2 < 6; ++index2)
                    {
                        float num2 = Easing.EaseIn((double)Math.Max((float)(index1 - (num1 - 9)) / 10f, 0.0f), EasingType.Sine) * (float)Math.Pow(1.0 - (double)this.Spline.TotalStep, 0.5);
                        this.TrailVertices[index1 * 6 + index2].Color = new Color(new Vector3(num2) * this.color);
                    }
                }
            }
Esempio n. 28
0
    // Lerp, quickly, between two rooms...
    // Because the lerp duration is standardised, the camera doesn't need to
    // report anywhere that it's complete, it can safely revert to idle.
    //
    void TransitionUpdate()
    {
        float fRatio = (TimerManager.fGameTime - m_fTransitionEventTime) / Types.s_fCAM_RoomTransitionDuration;

        transform.position = Vector3.Lerp(m_vOldCameraOrigin, m_vCameraOrigin, Easing.EaseIn(fRatio, EEasingType.Quintic));

        // Ensure the camera has snapped into the correct position and then revert to normal update
        if (fRatio >= 1.0f)
        {
            transform.position     = m_vCameraOrigin;
            m_iState               = ECameraState._IDLE;
            m_fTransitionEventTime = 0.0f;
        }
    }
Esempio n. 29
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();
        }
Esempio n. 30
0
    public virtual void CreateLine()
    {
        this.lineRenderer.SetVertexCount(this.pointCount);

        Vector3 startPosition = Vector3.zero;
        Vector3 endPosition   = new Vector3(this.distance, 0, 0);
        Vector3 direction     = new Vector3(this.distance / (float)this.pointCount, 0, 0);

        for (int i = 0; i < this.pointCount; i++)
        {
            float percentage = (float)i / (float)this.pointCount;

            //Debug.Log ( "Current velocity: " + this.currentVelocity );



            float currentDistance = this.distance * percentage;
            if (currentDistance < this.speedUpDistance)
            {
                float lerpPercentage = currentDistance / this.speedUpDistance;

                if (this.useEasing)
                {
                    lerpPercentage = Easing.EaseOut(lerpPercentage, EasingType.Quadratic);
                }

                this.currentVelocity = Mathf.Lerp(0, this.maxVelocity, lerpPercentage);
            }
            else if (currentDistance > (this.distance - this.slowDownDistance))
            {
                float lerpPercentage = (currentDistance - (this.distance - this.slowDownDistance)) / this.slowDownDistance;

                if (this.useEasing)
                {
                    lerpPercentage = Easing.EaseIn(lerpPercentage, EasingType.Cubic);
                }

                this.currentVelocity = Mathf.Lerp(this.maxVelocity, 0, lerpPercentage);
            }
            else
            {
                this.currentVelocity = this.maxVelocity;
            }

            Vector3 currentPosition = startPosition + direction * i;
            Vector3 velocityOffset  = new Vector3(0, this.currentVelocity, 0);

            this.lineRenderer.SetPosition(i, currentPosition + velocityOffset);
        }
    }