osu/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs

50 lines
1.9 KiB
C#
Raw Normal View History

2018-01-05 11:21:19 +00:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
2017-03-15 03:57:17 +00:00
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-04-18 07:05:58 +00:00
using osu.Game.Rulesets.Objects.Types;
2017-03-15 03:57:17 +00:00
using System.Collections.Generic;
using OpenTK;
using osu.Game.Audio;
2017-07-26 04:22:46 +00:00
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Objects.Legacy
{
internal abstract class ConvertSlider : HitObject, IHasCurve
{
/// <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 SliderCurve Curve { get; } = null;
public List<Vector2> ControlPoints { get; set; }
public CurveType CurveType { get; set; }
2017-05-29 03:19:38 +00:00
public double Distance { get; set; }
2017-12-25 06:35:28 +00:00
public List<List<SampleInfo>> RepeatSamples { get; set; }
public int RepeatCount { get; set; }
public double EndTime => StartTime + this.SpanCount() * Distance / Velocity;
public double Duration => EndTime - StartTime;
2017-05-29 03:19:51 +00:00
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;
}
}
}