2020-03-11 05:28:13 +00: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.
|
|
|
|
|
2020-12-07 09:12:55 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Pooling;
|
2021-06-16 07:14:42 +00:00
|
|
|
using osu.Framework.Timing;
|
2020-03-11 05:28:13 +00:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.UI
|
|
|
|
{
|
2021-06-16 05:01:12 +00:00
|
|
|
/// <summary>
|
|
|
|
/// A trail of the catcher.
|
|
|
|
/// It also represents a hyper dash afterimage.
|
|
|
|
/// </summary>
|
2021-06-14 10:47:18 +00:00
|
|
|
public class CatcherTrail : PoolableDrawable
|
2020-03-11 05:28:13 +00:00
|
|
|
{
|
2021-06-14 10:45:58 +00:00
|
|
|
public CatcherAnimationState AnimationState
|
2020-03-11 05:28:13 +00:00
|
|
|
{
|
2021-06-14 10:45:58 +00:00
|
|
|
set => body.AnimationState.Value = value;
|
2020-12-07 09:12:55 +00:00
|
|
|
}
|
|
|
|
|
2021-06-14 10:45:58 +00:00
|
|
|
private readonly SkinnableCatcher body;
|
2020-12-07 09:12:55 +00:00
|
|
|
|
2021-06-14 10:47:18 +00:00
|
|
|
public CatcherTrail()
|
2020-12-07 09:12:55 +00:00
|
|
|
{
|
2021-07-21 07:43:24 +00:00
|
|
|
Size = new Vector2(Catcher.BASE_SIZE);
|
2021-06-14 10:45:58 +00:00
|
|
|
Origin = Anchor.TopCentre;
|
2021-06-14 10:46:48 +00:00
|
|
|
Blending = BlendingParameters.Additive;
|
2021-06-16 07:14:42 +00: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()),
|
|
|
|
};
|
2020-03-11 05:28:13 +00:00
|
|
|
}
|
2020-12-08 08:31:00 +00:00
|
|
|
|
|
|
|
protected override void FreeAfterUse()
|
|
|
|
{
|
|
|
|
ClearTransforms();
|
2021-06-24 07:12:43 +00:00
|
|
|
Alpha = 1;
|
2020-12-08 08:31:00 +00:00
|
|
|
base.FreeAfterUse();
|
|
|
|
}
|
2020-03-11 05:28:13 +00:00
|
|
|
}
|
|
|
|
}
|