1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 14:12:56 +08:00

Make fruit look a bit better (and buffer them to a texture)

This commit is contained in:
Dean Herbert 2017-08-08 12:46:01 +09:00
parent 3926238be9
commit 99a00ed319

View File

@ -17,12 +17,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
internal class DrawableFruit : DrawableScrollingHitObject<CatchBaseHit, CatchJudgement> internal class DrawableFruit : DrawableScrollingHitObject<CatchBaseHit, CatchJudgement>
{ {
private Box box; const float pulp_size = 30;
private class Pulp : Circle, IHasAccentColour private class Pulp : Circle, IHasAccentColour
{ {
public Pulp() public Pulp()
{ {
Size = new Vector2(pulp_size);
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
@ -38,11 +40,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
public DrawableFruit(CatchBaseHit h) : base(h) public DrawableFruit(CatchBaseHit h) : base(h)
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2(50); Size = new Vector2(pulp_size * 2, pulp_size * 2.6f);
RelativePositionAxes = Axes.Both; RelativePositionAxes = Axes.Both;
X = h.Position; X = h.Position;
Colour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1);
Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
} }
@ -51,47 +55,42 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
{ {
box = new Box //todo: share this more
new BufferedContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Blue, 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 new Pulp
{ {
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
RelativeSizeAxes = Axes.Both, Anchor = Anchor.CentreLeft,
Anchor = Anchor.TopCentre, Origin = Anchor.CentreLeft,
Origin = Anchor.Centre, Y = -0.08f
Scale = new Vector2(0.12f),
Y = 0.08f,
}, },
new Pulp new Pulp
{ {
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
RelativeSizeAxes = Axes.Both, Anchor = Anchor.CentreRight,
Anchor = Anchor.TopCentre, Origin = Anchor.CentreRight,
Origin = Anchor.Centre, Y = -0.08f
Scale = new Vector2(0.32f),
Position = new Vector2(-0.16f, 0.3f),
}, },
new Pulp new Pulp
{ {
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
RelativeSizeAxes = Axes.Both, Anchor = Anchor.BottomCentre,
Anchor = Anchor.TopCentre, Origin = Anchor.BottomCentre,
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),
}, },
}
}
}; };
} }
@ -117,10 +116,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
case ArmedState.Miss: case ArmedState.Miss:
using (BeginAbsoluteSequence(HitObject.StartTime, true)) using (BeginAbsoluteSequence(HitObject.StartTime, true))
{
this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out); this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out);
box.FadeColour(Color4.OrangeRed);
}
break; break;
} }
} }