2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-09-02 17:35:49 +08:00
|
|
|
|
|
2016-11-28 17:45:50 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2016-12-06 20:14:38 +08:00
|
|
|
|
using OpenTK;
|
2016-09-02 17:35:49 +08:00
|
|
|
|
|
2016-11-14 17:54:24 +08:00
|
|
|
|
namespace osu.Game.Modes.Osu.Objects
|
2016-09-02 17:35:49 +08:00
|
|
|
|
{
|
2016-11-19 18:07:57 +08:00
|
|
|
|
public class Slider : OsuHitObject
|
2016-09-02 17:35:49 +08:00
|
|
|
|
{
|
2016-11-28 17:45:50 +08:00
|
|
|
|
public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity;
|
2016-11-28 14:31:54 +08:00
|
|
|
|
|
2016-12-06 20:14:38 +08:00
|
|
|
|
public override Vector2 EndPosition => RepeatCount % 2 == 0 ? Position : Curve.PositionAt(1);
|
|
|
|
|
|
2017-02-09 15:29:21 +08:00
|
|
|
|
private int stackHeight;
|
|
|
|
|
public override int StackHeight
|
|
|
|
|
{
|
|
|
|
|
get { return stackHeight; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
stackHeight = value;
|
|
|
|
|
if (Curve != null)
|
|
|
|
|
Curve.Offset = StackOffset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-28 17:45:50 +08:00
|
|
|
|
public double Velocity;
|
|
|
|
|
|
|
|
|
|
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
|
|
|
|
|
{
|
2016-12-11 17:11:22 +08:00
|
|
|
|
base.SetDefaultsFromBeatmap(beatmap);
|
|
|
|
|
|
2016-11-28 17:45:50 +08:00
|
|
|
|
Velocity = 100 / beatmap.BeatLengthAt(StartTime, true) * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
|
|
|
|
|
}
|
2016-09-02 17:35:49 +08:00
|
|
|
|
|
|
|
|
|
public int RepeatCount;
|
2016-11-17 20:29:35 +08:00
|
|
|
|
|
|
|
|
|
public SliderCurve Curve;
|
2016-09-02 17:35:49 +08:00
|
|
|
|
}
|
2016-11-17 20:29:35 +08:00
|
|
|
|
|
|
|
|
|
public enum CurveTypes
|
|
|
|
|
{
|
|
|
|
|
Catmull,
|
|
|
|
|
Bezier,
|
|
|
|
|
Linear,
|
|
|
|
|
PerfectCurve
|
2016-11-28 11:15:25 +08:00
|
|
|
|
}
|
2016-09-02 17:35:49 +08:00
|
|
|
|
}
|