1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 13:12:57 +08:00
osu-lazer/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs
smoogipooo 5bd9147661 Remove CreateCircle() - hitobjects should handle the addition of this to their hierarchy themselves.
CreateCircle() lends itself to a few issues:
- It can't be used for drum roll ticks unless it returned a Container instead, at which point the method loses its meaning, and I would rather that constructed in the ctor.
- Writing `return Accented ? new AccentedCirclePiece() : new CirclePiece()` in two places as the body of this method feels wrong - it's something I would expect to be taken care of in the base DrawableTaikoHitObject, but that leads back to #1.
- Swells don't have an AccentedCirclePiece, so #2 becomes more problematic.
2017-03-25 20:53:45 +09:00

47 lines
1.5 KiB
C#

// 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;
namespace osu.Game.Modes.Taiko.Objects.Drawable
{
public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject, TaikoJudgement>
{
protected DrawableTaikoHitObject(TaikoHitObject hitObject)
: base(hitObject)
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
RelativePositionAxes = Axes.X;
}
protected override void LoadComplete()
{
LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2;
LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt;
base.LoadComplete();
}
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement();
/// <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>
protected virtual void UpdateScrollPosition(double time)
{
MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt));
}
protected override void Update()
{
UpdateScrollPosition(Time.Current);
}
}
}