osu/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs

50 lines
1.3 KiB
C#
Raw Normal View History

2016-11-17 12:29:35 +00:00
using osu.Framework.Graphics;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
using OpenTK;
namespace osu.Game.Modes.Osu.Objects.Drawables
{
class DrawableSlider : DrawableOsuHitObject
{
public DrawableSlider(Slider h) : base(h)
{
2016-11-17 12:29:35 +00:00
Origin = Anchor.Centre;
RelativePositionAxes = Axes.Both;
Position = new Vector2(h.Position.X / 512, h.Position.Y / 384);
2016-11-17 12:29:35 +00:00
for (float i = 0; i <= 1; i += 0.1f)
{
Add(new CirclePiece
{
Colour = h.Colour,
Position = h.Curve.PositionAt(i) - h.Position //non-relative?
});
}
}
protected override void LoadComplete()
{
base.LoadComplete();
//force application of the state that was set before we loaded.
UpdateState(State);
}
protected override void UpdateState(ArmedState state)
{
2016-11-17 12:29:35 +00:00
if (!IsLoaded) return;
Flush(true); //move to DrawableHitObject
Alpha = 0;
Delay(HitObject.StartTime - 200 - Time.Current, true);
2016-11-17 12:29:35 +00:00
FadeIn(200);
Delay(200 + HitObject.Duration);
FadeOut(200);
}
}
}