2017-03-20 18:17:31 +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
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
|
|
|
|
using osu.Game.Modes.Taiko.Judgements;
|
2017-03-24 14:14:49 +08:00
|
|
|
|
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
2017-03-20 18:17:31 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|
|
|
|
{
|
2017-03-23 18:00:18 +08:00
|
|
|
|
public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
2017-03-20 18:17:31 +08:00
|
|
|
|
{
|
|
|
|
|
protected DrawableTaikoHitObject(TaikoHitObject hitObject)
|
|
|
|
|
: base(hitObject)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft;
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
|
|
RelativePositionAxes = Axes.X;
|
2017-03-24 14:19:58 +08:00
|
|
|
|
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
CreateCircle()
|
|
|
|
|
};
|
2017-03-23 10:05:58 +08:00
|
|
|
|
}
|
2017-03-20 18:17:31 +08:00
|
|
|
|
|
2017-03-23 10:05:58 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
2017-03-20 18:17:31 +08:00
|
|
|
|
LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2;
|
|
|
|
|
LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt;
|
|
|
|
|
|
2017-03-23 10:05:58 +08:00
|
|
|
|
base.LoadComplete();
|
2017-03-20 18:17:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 18:00:18 +08:00
|
|
|
|
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement();
|
2017-03-20 18:17:31 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sets the scroll position of the DrawableHitObject relative to the offset between
|
|
|
|
|
/// a time value and the HitObject's StartTime.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="time"></param>
|
2017-03-22 00:46:06 +08:00
|
|
|
|
protected virtual void UpdateScrollPosition(double time)
|
2017-03-20 18:17:31 +08:00
|
|
|
|
{
|
|
|
|
|
MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
UpdateScrollPosition(Time.Current);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-24 17:37:56 +08:00
|
|
|
|
protected abstract CirclePiece CreateCircle();
|
2017-03-20 18:17:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|