示例#1
0
 public void Perform(float start, float end, float thickness, LerpHelper.Delegate lerp, ISlider slider)
 {
     Start = start;
     End   = end;
     Thickness.Set(thickness, 0, lerp, 1);
     Slider = slider;
 }
示例#2
0
        public void UpdateScroll()
        {
            if (SelectionAreas.Empty())
            {
                return;
            }
            var currentTop    = SelectionAreas[Selection].GetTop();
            var currentBottom = SelectionAreas[Selection].GetBottom();

            if (currentTop < Scroll)
            {
                Scroll.Set(currentTop, LerpHelper.Linear, 5);
            }
            if (currentBottom > Scroll + Height)
            {
                Scroll.Set(currentBottom - Height, LerpHelper.Linear, 5);
            }
        }
示例#3
0
        public SceneTitle(Game game) : base(game)
        {
            Menu       = new TitleUI(this);
            FloorBatch = new PrimitiveBatch <VertexPositionNormalTexture>(GraphicsDevice);

            MorphoPositionBase = new LerpVector2(new Vector2(650, Viewport.Height + 160));
            MorphoHeight       = new LerpFloat(40);
            GroundVelocityBase = new LerpVector2(new Vector2(2, 6) * 0.2f);
            CastleHeight       = new LerpFloat(0);

            var fade = new ScreenFade(this, () => ColorMatrix.Tint(Color.Black), 1, true);


            TitleSM.AddState(TitleState.FadeIn, new TitleStateMachine.Transfer(TitleState.SpeedUp), (state, content, input) => new TitleStateMachine.Data(60));
            TitleSM.AddState(TitleState.SpeedUp, new TitleStateMachine.Transfer(TitleState.MorphoAppear), (state, content, input) => new TitleStateMachine.Data(60));
            TitleSM.AddState(TitleState.MorphoAppear, new TitleStateMachine.Transfer(TitleState.CastleAppear), (state, content, input) => new TitleStateMachine.Data(60));
            TitleSM.AddState(TitleState.CastleAppear, new TitleStateMachine.Transfer(TitleState.TextSlash), (state, content, input) => new TitleStateMachine.Data(320));
            TitleSM.AddState(TitleState.TextSlash, new TitleStateMachine.Transfer(TitleState.TextArrange), (state, content, input) => new TitleStateMachine.Data(40));
            TitleSM.AddState(TitleState.TextArrange, new TitleStateMachine.Transfer(TitleState.Finish), (state, content, input) => new TitleStateMachine.Data(40));
            TitleSM.AddState(TitleState.Finish, new TitleStateMachine.Finish(), (state, content, input) => new TitleStateMachine.Data(0));
            TitleSM.AddOnLeave(TitleState.FadeIn, (input) =>
            {
                fade.Lerp.Set(0, LerpHelper.QuadraticOut, 60);
            });
            TitleSM.AddOnEnter(TitleState.SpeedUp, (input) =>
            {
                GroundVelocityBase.Set(new Vector2(2, 6) * 1.5f, LerpHelper.QuadraticIn, 90);
            });
            TitleSM.AddOnEnter(TitleState.MorphoAppear, (input) =>
            {
                MorphoPositionBase.Set(new Vector2(550, 550), LerpHelper.QuadraticOut, 60);
                MorphoHeight.Set(80, LerpHelper.QuadraticOut, 60);
                CastleHeight.Set(400, LerpHelper.QuadraticOut, 400);
            });
            TitleSM.AddOnEnter(TitleState.TextSlash, (input) =>
            {
                int textX = Viewport.Width / 2;
                int textY = Viewport.Height / 10 + 40;
                MorphoFlash.AddFlash(ColorMatrix.Flat(Color.White), 10);
                TextFlash.AddFlash(ColorMatrix.Flat(Color.Red), 10);
                Particles.Add(new Particle(new SlashEffect(this, 300, 15)
                {
                    Angle = Random.NextFloat(MathHelper.PiOver2 - 0.1f, MathHelper.PiOver2 + 0.1f),
                }, new Vector2(textX, textY)));
                new ScreenShakeRandom(this, 10, 10, LerpHelper.QuadraticOut);
            });
            TitleSM.AddOnLeave(TitleState.TextArrange, (input) =>
            {
                TextFlash.AddFlash(ColorMatrix.Flat(Color.White), 10);
                new ScreenShakeRandom(this, 10, 20, LerpHelper.QuadraticOut);
            });
            TitleSM.Start(TitleState.FadeIn);



            ProtoEffects.Update();
        }
示例#4
0
        /*private Color GetTextColor(int index)
         * {
         *  string text = Amount.ToString();
         *  float width = 8;
         *  float center = (float)LerpHelper.Quadratic(-width, text.Length + width, Frame.GetSubSlide(0, 30));
         *  float dist = Math.Abs(index - center);
         *  return Color.Lerp(Color.Gold, Color.Black, (float)LerpHelper.QuadraticIn(0, 1, MathHelper.Clamp(dist / width, 0, 1)));
         * }*/

        public override void Update()
        {
            base.Update();
            if (Frame.Done)
            {
                Destroy();
            }
            Flicker.Update();
            FlickerTime += Flicker;
            if (FlickerTime < 0 || FlickerTime > 1)
            {
                FlickerTime = Util.PositiveMod(FlickerTime, 1);
            }
            if (Frame.Slide > 0.8f)
            {
                Flicker.Set(0.5f, LerpHelper.Linear, Frame.EndTime * 0.2f);
            }
            Text.Update();
        }