1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:02:54 +08:00

Give fruit a border

This commit is contained in:
Dean Herbert 2017-12-31 22:09:07 +09:00
parent fd34b36e1a
commit cf1f84cc32

View File

@ -4,15 +4,19 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using System;
namespace osu.Game.Rulesets.Catch.Objects.Drawable namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
public class DrawableFruit : DrawableCatchHitObject<Fruit> public class DrawableFruit : DrawableCatchHitObject<Fruit>
{ {
private Circle border;
public DrawableFruit(Fruit h) public DrawableFruit(Fruit h)
: base(h) : base(h)
{ {
@ -69,7 +73,25 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
AccentColour = AccentColour, AccentColour = AccentColour,
}, },
} }
} },
border = new Circle
{
Size = new Vector2(Pulp.PULP_SIZE * 3.5f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BorderColour = AccentColour,
BorderThickness = 3,
Children = new Framework.Graphics.Drawable[]
{
new Box
{
AlwaysPresent = true,
Colour = AccentColour,
Alpha = 0,
RelativeSizeAxes = Axes.Both
}
}
},
}; };
if (HitObject.HyperDash) if (HitObject.HyperDash)
@ -86,5 +108,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
}); });
} }
} }
protected override void Update()
{
base.Update();
border.Alpha = (float)MathHelper.Clamp((HitObject.StartTime - Time.Current) / 1000, 0, 1);
}
} }
} }