Ejemplo n.º 1
0
        public void PlayAnimation()
        {
            var animation = mainPiece as IFramedAnimation;

            animation?.GotoFrame(0);

            if (particles != null)
            {
                // start the particles already some way into their animation to break cluster away from centre.
                using (particles.BeginDelayedSequence(-100))
                    particles.Restart();
            }

            const double fade_in_length  = 120;
            const double fade_out_delay  = 500;
            const double fade_out_length = 600;

            this.FadeInFromZero(fade_in_length);
            this.Delay(fade_out_delay).FadeOut(fade_out_length);

            // new style non-miss judgements show the original style temporarily, with additive colour.
            if (temporaryOldStyle != null)
            {
                temporaryOldStyle.PlayAnimation();

                temporaryOldStyle.Hide();
                temporaryOldStyle.Delay(-16)
                .FadeTo(0.5f, 56, Easing.Out).Then()
                .FadeOut(300);
            }

            // legacy judgements don't play any transforms if they are an animation.
            if (animation?.FrameCount > 1)
            {
                return;
            }

            switch (result)
            {
            case HitResult.Miss:
                this.ScaleTo(1.6f);
                this.ScaleTo(1, 100, Easing.In);

                //todo: this only applies to osu! ruleset apparently.
                this.MoveTo(new Vector2(0, -2));
                this.MoveToOffset(new Vector2(0, 20), fade_out_delay + fade_out_length, Easing.In);

                float rotation = RNG.NextSingle(-8.6f, 8.6f);

                this.RotateTo(0);
                this.RotateTo(rotation, fade_in_length)
                .Then().RotateTo(rotation * 2, fade_out_delay + fade_out_length - fade_in_length, Easing.In);
                break;

            default:
                mainPiece.ScaleTo(0.9f);
                mainPiece.ScaleTo(1.05f, fade_out_delay + fade_out_length);
                break;
            }
        }
Ejemplo n.º 2
0
        private void load(TextureStore textures)
        {
            AddStep("create initial", () =>
            {
                Child = explosion = new ParticleExplosion(textures.Get("Cursor/cursortrail"), 150, 1200)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size   = new Vector2(400)
                };
            });

            AddWaitStep("wait for playback", 5);

            AddRepeatStep(@"restart animation", () =>
            {
                explosion.Restart();
            }, 10);
        }