osu/osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs

51 lines
1.7 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.
2018-04-13 09:19:50 +00:00
2020-10-02 05:20:55 +00:00
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Scoring;
2018-04-13 09:19:50 +00:00
namespace osu.Game.Rulesets.Osu.Objects
{
2020-10-02 05:20:55 +00:00
/// <summary>
/// A hit circle which is at the end of a slider path (either repeat or final tail).
2020-10-02 05:20:55 +00:00
/// </summary>
public abstract class SliderEndCircle : HitCircle
2018-04-13 09:19:50 +00:00
{
private readonly Slider slider;
protected SliderEndCircle(Slider slider)
{
this.slider = slider;
}
2020-10-02 05:20:55 +00:00
public int RepeatIndex { get; set; }
public double SpanDuration => slider.SpanDuration;
2020-10-02 05:20:55 +00:00
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
if (RepeatIndex > 0)
{
// Repeat points after the first span should appear behind the still-visible one.
TimeFadeIn = 0;
// The next end circle should appear exactly after the previous circle (on the same end) is hit.
TimePreempt = SpanDuration * 2;
}
else
{
// taken from osu-stable
const float first_end_circle_preempt_adjust = 2 / 3f;
// The first end circle should fade in with the slider.
TimePreempt = (StartTime - slider.StartTime) + slider.TimePreempt * first_end_circle_preempt_adjust;
}
2020-10-02 05:20:55 +00:00
}
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
2018-04-13 09:19:50 +00:00
}
}