2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-10 15:34:01 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2024-09-17 14:37:54 +08:00
|
|
|
|
using osu.Framework.Utils;
|
2020-12-07 11:35:24 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Skinning.Default;
|
2020-02-19 12:27:15 +08:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-02-19 17:01:59 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
2017-10-10 15:34:01 +08:00
|
|
|
|
{
|
2020-12-09 09:25:35 +08:00
|
|
|
|
public partial class DrawableDroplet : DrawablePalpableCatchHitObject
|
2017-10-10 15:34:01 +08:00
|
|
|
|
{
|
2020-11-30 18:04:09 +08:00
|
|
|
|
public DrawableDroplet()
|
|
|
|
|
: this(null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-15 15:27:49 +08:00
|
|
|
|
public DrawableDroplet(CatchHitObject? h)
|
2017-10-10 15:34:01 +08:00
|
|
|
|
: base(h)
|
|
|
|
|
{
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-10 15:34:01 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
2020-11-27 10:40:38 +08:00
|
|
|
|
{
|
2020-12-10 18:42:01 +08:00
|
|
|
|
ScalingContainer.Child = new SkinnableDrawable(
|
2022-11-09 15:04:56 +08:00
|
|
|
|
new CatchSkinComponentLookup(CatchSkinComponents.Droplet),
|
2020-12-10 18:42:01 +08:00
|
|
|
|
_ => new DropletPiece());
|
2020-02-19 14:16:19 +08:00
|
|
|
|
}
|
2020-02-19 16:55:40 +08:00
|
|
|
|
|
2024-09-17 14:37:54 +08:00
|
|
|
|
private float startRotation;
|
|
|
|
|
|
2024-09-17 15:18:29 +08:00
|
|
|
|
protected override void UpdateInitialTransforms()
|
2020-02-19 16:55:40 +08:00
|
|
|
|
{
|
2024-09-17 15:18:29 +08:00
|
|
|
|
base.UpdateInitialTransforms();
|
2020-02-19 16:55:40 +08:00
|
|
|
|
|
2024-09-17 15:18:29 +08:00
|
|
|
|
// Important to have this in UpdateInitialTransforms() to it is re-triggered by RefreshStateTransforms().
|
2024-09-17 14:37:54 +08:00
|
|
|
|
startRotation = RandomSingle(1) * 20;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
2020-02-19 16:55:40 +08:00
|
|
|
|
|
2024-09-17 15:15:45 +08:00
|
|
|
|
// No clamping for droplets. They should be considered indefinitely spinning regardless of time.
|
|
|
|
|
// They also never end up on the plate, so they shouldn't stop spinning when caught.
|
2024-09-17 14:37:54 +08:00
|
|
|
|
double preemptProgress = (Time.Current - (HitObject.StartTime - InitialLifetimeOffset)) / (HitObject.TimePreempt + 2000);
|
|
|
|
|
ScalingContainer.Rotation = (float)Interpolation.Lerp(startRotation, startRotation + 720, preemptProgress);
|
2020-02-19 16:55:40 +08:00
|
|
|
|
}
|
2017-10-10 15:34:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|