1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 23:42:55 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs
2024-09-17 15:38:51 +09:00

50 lines
1.4 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 osu.Framework.Allocation;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
public partial class DrawableDroplet : DrawablePalpableCatchHitObject
{
public DrawableDroplet()
: this(null)
{
}
public DrawableDroplet(CatchHitObject? h)
: base(h)
{
}
[BackgroundDependencyLoader]
private void load()
{
ScalingContainer.Child = new SkinnableDrawable(
new CatchSkinComponentLookup(CatchSkinComponents.Droplet),
_ => new DropletPiece());
}
private float startRotation;
protected override void OnApply()
{
base.OnApply();
// roughly matches osu-stable
startRotation = RandomSingle(1) * 20;
}
protected override void Update()
{
base.Update();
double preemptProgress = (Time.Current - (HitObject.StartTime - InitialLifetimeOffset)) / (HitObject.TimePreempt + 2000);
ScalingContainer.Rotation = (float)Interpolation.Lerp(startRotation, startRotation + 720, preemptProgress);
}
}
}