mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 07:38:21 +08:00
47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using osu.Game.Modes.Objects.Types;
|
|
using System.Collections.Generic;
|
|
using OpenTK;
|
|
|
|
namespace osu.Game.Modes.Objects
|
|
{
|
|
public class CurvedHitObject : HitObject, IHasCurve
|
|
{
|
|
public SliderCurve Curve { get; } = new SliderCurve();
|
|
|
|
public int RepeatCount { get; set; } = 1;
|
|
|
|
public double EndTime => 0;
|
|
public double Duration => 0;
|
|
|
|
public List<Vector2> ControlPoints
|
|
{
|
|
get { return Curve.ControlPoints; }
|
|
set { Curve.ControlPoints = value; }
|
|
}
|
|
|
|
public CurveType CurveType
|
|
{
|
|
get { return Curve.CurveType; }
|
|
set { Curve.CurveType = value; }
|
|
}
|
|
|
|
public double Distance
|
|
{
|
|
get { return Curve.Distance; }
|
|
set { Curve.Distance = value; }
|
|
}
|
|
|
|
public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress));
|
|
|
|
public double ProgressAt(double progress)
|
|
{
|
|
var p = progress * RepeatCount % 1;
|
|
if (RepeatAt(progress) % 2 == 1)
|
|
p = 1 - p;
|
|
return p;
|
|
}
|
|
|
|
public int RepeatAt(double progress) => (int)(progress * RepeatCount);
|
|
}
|
|
}
|