1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 03:27:26 +08:00
osu-lazer/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs

49 lines
1.8 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 17:19:50 +08:00
using osu.Game.Rulesets.Objects.Types;
using System.Collections.Generic;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Objects.Legacy
{
2018-06-13 21:20:34 +08:00
internal abstract class ConvertSlider : HitObject, IHasCurve, IHasLegacyLastTickOffset
2018-04-13 17:19:50 +08:00
{
/// <summary>
/// Scoring distance with a speed-adjusted beat length of 1 second.
/// </summary>
private const float base_scoring_distance = 100;
/// <summary>
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
/// </summary>
public SliderPath Path { get; set; }
2018-04-13 17:19:50 +08:00
2018-11-12 13:07:48 +08:00
public double Distance => Path.Distance;
2018-04-13 17:19:50 +08:00
2019-11-08 13:04:57 +08:00
public List<IList<HitSampleInfo>> NodeSamples { get; set; }
2018-04-13 17:19:50 +08:00
public int RepeatCount { get; set; }
public double EndTime => StartTime + this.SpanCount() * Distance / Velocity;
public double Duration => EndTime - StartTime;
public double Velocity = 1;
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(StartTime);
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
Velocity = scoringDistance / timingPoint.BeatLength;
}
2018-06-13 21:20:34 +08:00
public double LegacyLastTickOffset => 36;
2018-04-13 17:19:50 +08:00
}
}