1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 05:57:52 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs

47 lines
1.6 KiB
C#
Raw Normal View History

// 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;
2017-08-20 20:18:21 +08:00
using osu.Framework.Input.Bindings;
2017-04-18 15:05:58 +08:00
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using OpenTK;
2017-04-18 15:05:58 +08:00
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
2017-08-20 22:47:07 +08:00
public abstract class DrawableTaikoHitObject<TaikoHitType>
: DrawableScrollingHitObject<TaikoHitObject, TaikoJudgement>, IKeyBindingHandler<TaikoAction>
where TaikoHitType : TaikoHitObject
{
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
protected readonly Vector2 BaseSize;
protected readonly TaikoPiece MainPiece;
public new TaikoHitType HitObject;
protected DrawableTaikoHitObject(TaikoHitType hitObject)
: base(hitObject)
{
HitObject = hitObject;
Anchor = Anchor.CentreLeft;
Origin = Anchor.Custom;
RelativeSizeAxes = Axes.Both;
Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
Add(MainPiece = CreateMainPiece());
MainPiece.KiaiMode = HitObject.Kiai;
}
2017-08-03 18:49:50 +08:00
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece();
2017-08-20 20:18:21 +08:00
public abstract bool OnPressed(TaikoAction action);
2017-08-20 20:18:21 +08:00
public virtual bool OnReleased(TaikoAction action) => false;
}
}