예제 #1
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();
        }
예제 #2
0
 public ScreenFade(Scene world, Func <ColorMatrix> color, float start, bool delete) : base(world, 1)
 {
     ColorFunction = color;
     Lerp          = new LerpFloat(start);
     Delete        = false;
 }