Store a DHO in FruitPiece to animate itself.

This commit is contained in:
ekrctb
2020-11-30 13:46:02 +09:00
parent 5e0e4e9db7
commit 4228977c86
2 changed files with 24 additions and 21 deletions

View File

@ -16,8 +16,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
private FruitPiece fruitPiece;
public DrawableFruit(CatchHitObject h)
: base(h)
{
@ -41,21 +39,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
ScaleContainer.Child = new SkinnableDrawable(
new CatchSkinComponent(getComponent(VisualRepresentation.Value)),
_ => fruitPiece = new FruitPiece
_ => new FruitPiece
{
VisualRepresentation = { BindTarget = VisualRepresentation },
HyperDash = { BindTarget = HyperDash },
});
}
protected override void Update()
{
base.Update();
if (fruitPiece != null)
fruitPiece.Border.Alpha = (float)Math.Clamp((StartTimeBindable.Value - Time.Current) / 500, 0, 1);
}
private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation)
{
switch (hitObjectVisualRepresentation)