1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 21:27:25 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs
ekrctb 0d73bf8488 Refactor catch default piece to allow reuse
But Fruit in-place update is still incomplete,
as child drawables are recreated when reused.
2020-12-07 13:14:00 +09:00

46 lines
1.3 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
public class DrawableDroplet : DrawablePalpableCatchHitObject
{
public override bool StaysOnPlate => false;
public DrawableDroplet()
: this(null)
{
}
public DrawableDroplet([CanBeNull] CatchHitObject h)
: base(h)
{
}
[BackgroundDependencyLoader]
private void load()
{
ScaleContainer.Child = new SkinnableDrawable(
new CatchSkinComponent(CatchSkinComponents.Droplet),
_ => new DropletPiece());
}
protected override void UpdateInitialTransforms()
{
base.UpdateInitialTransforms();
// roughly matches osu-stable
float startRotation = RandomSingle(1) * 20;
double duration = HitObject.TimePreempt + 2000;
ScaleContainer.RotateTo(startRotation).RotateTo(startRotation + 720, duration);
}
}
}