From 99a00ed3190b68063357adee55e07899d192c061 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Aug 2017 12:46:01 +0900 Subject: [PATCH] Make fruit look a bit better (and buffer them to a texture) --- .../Objects/Drawable/DrawableFruit.cs | 84 +++++++++---------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 8531428acf..f8b0830089 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -17,12 +17,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { internal class DrawableFruit : DrawableScrollingHitObject { - private Box box; + const float pulp_size = 30; private class Pulp : Circle, IHasAccentColour { public Pulp() { + Size = new Vector2(pulp_size); + EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, @@ -38,11 +40,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable public DrawableFruit(CatchBaseHit h) : base(h) { Origin = Anchor.Centre; - Size = new Vector2(50); + Size = new Vector2(pulp_size * 2, pulp_size * 2.6f); RelativePositionAxes = Axes.Both; X = h.Position; + Colour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1); + Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; } @@ -51,47 +55,42 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Children = new Framework.Graphics.Drawable[] { - box = new Box + //todo: share this more + new BufferedContainer { RelativeSizeAxes = Axes.Both, - Colour = Color4.Blue, - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Scale = new Vector2(0.12f), - Y = 0.08f, - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Scale = new Vector2(0.32f), - Position = new Vector2(-0.16f, 0.3f), - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Scale = new Vector2(0.32f), - Position = new Vector2(0.16f, 0.3f), - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Scale = new Vector2(0.32f), - Position = new Vector2(0, 0.6f), - }, + CacheDrawnFrameBuffer = true, + Children = new Framework.Graphics.Drawable[] + { + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Scale = new Vector2(0.6f), + }, + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Y = -0.08f + }, + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Y = -0.08f + }, + new Pulp + { + RelativePositionAxes = Axes.Both, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }, + } + } }; } @@ -117,10 +116,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { case ArmedState.Miss: using (BeginAbsoluteSequence(HitObject.StartTime, true)) - { this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out); - box.FadeColour(Color4.OrangeRed); - } break; } }