1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00
osu-lazer/osu.Game.Rulesets.Catch/UI/CatcherTrail.cs

45 lines
1.4 KiB
C#
Raw Normal View History

// 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.
2020-12-07 17:12:55 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Pooling;
2021-06-16 15:14:42 +08:00
using osu.Framework.Timing;
using osuTK;
namespace osu.Game.Rulesets.Catch.UI
{
2021-06-16 13:01:12 +08:00
/// <summary>
/// A trail of the catcher.
/// It also represents a hyper dash afterimage.
/// </summary>
public class CatcherTrail : PoolableDrawable
{
public CatcherAnimationState AnimationState
{
set => body.AnimationState.Value = value;
2020-12-07 17:12:55 +08:00
}
private readonly SkinnableCatcher body;
2020-12-07 17:12:55 +08:00
public CatcherTrail()
2020-12-07 17:12:55 +08:00
{
Size = new Vector2(Catcher.BASE_SIZE);
Origin = Anchor.TopCentre;
2021-06-14 18:46:48 +08:00
Blending = BlendingParameters.Additive;
2021-06-16 15:14:42 +08:00
InternalChild = body = new SkinnableCatcher
{
// Using a frozen clock because trails should not be animated when the skin has an animated catcher.
// TODO: The animation should be frozen at the animation frame at the time of the trail generation.
Clock = new FramedClock(new ManualClock()),
};
}
protected override void FreeAfterUse()
{
ClearTransforms();
Alpha = 1;
base.FreeAfterUse();
}
}
}