예제 #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 SceneMascot(Game game) : base(game)
 {
     MascotSM = new MascotMachine();
     MascotSM.AddState(MascotState.Empty, new MascotMachine.Transfer(MascotState.FadeIn), (state, content, input) => new MascotMachine.Data(EmptyTime));
     MascotSM.AddState(MascotState.FadeIn, new MascotMachine.Transfer(MascotState.OpenEye), (state, content, input) => new MascotMachine.Data(FadeInTime));
     MascotSM.AddState(MascotState.OpenEye, new MascotMachine.Transfer(MascotState.Idle), (state, content, input) => new MascotMachine.Data(OpenEyeTime));
     MascotSM.AddState(MascotState.Idle, new MascotMachine.Transfer(MascotState.FadeOut), (state, content, input) => new MascotMachine.Data(IdleTime));
     MascotSM.AddState(MascotState.FadeOut, new MascotMachine.Transfer(MascotState.Finish), (state, content, input) => new MascotMachine.Data(FadeOutTime));
     MascotSM.AddState(MascotState.Finish, new MascotMachine.Finish(), (state, content, input) => new MascotMachine.Data(0));
     MascotSM.AddOnLeave(MascotState.OpenEye, (input) =>
     {
         Vector2 pos = new Vector2(Viewport.Width / 2, Viewport.Height / 2);
         MascotFlash.AddFlash(ColorMatrix.Flat(Color.Red), 10);
         var star = new BigStar(this, SpriteLoader.Instance.AddSprite("content/effect_star_big"))
         {
             Color = Color.Red,
         };
         star.Angle.Set(0, MathHelper.Pi, LerpHelper.QuadraticOut, 30);
         star.Scale.Set(1f, 0.1f, LerpHelper.QuadraticIn, 30);
         star.ShouldDestroy.Set(true, LerpHelper.Linear, 30);
         var wave = new Wave(this, SpriteLoader.Instance.AddSprite("content/ring_spark_thin"), 30)
         {
             Radius      = 128,
             Precision   = 8,
             StartRadius = 0.3f,
             Thickness   = 0.5f,
             InnerLerp   = LerpHelper.QuadraticOut,
             OuterLerp   = LerpHelper.QuadraticOut,
             Color       = ColorMatrix.Tint(Color.Red),
         };
         VisualEffects.Add(new VisualEffect(star, pos + new Vector2(17, -17) * 2));
         VisualEffects.Add(new VisualEffect(wave, pos + new Vector2(17, -17) * 2));
     });
     MascotSM.AddOnEnter(MascotState.Finish, (input) =>
     {
         Game.Scene = new SceneTitle(Game);
     });
     MascotSM.Start(MascotState.Empty);
 }