1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00
osu-lazer/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs

54 lines
1.5 KiB
C#
Raw Normal View History

2017-03-20 17:24:28 +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 OpenTK.Input;
using osu.Game.Modes.Taiko.Judgements;
using System;
using osu.Game.Modes.Objects.Drawables;
namespace osu.Game.Modes.Taiko.Objects.Drawable
{
2017-03-17 18:27:06 +08:00
public class DrawableDrumRollTick : DrawableTaikoHitObject
{
2017-03-23 18:43:49 +08:00
private readonly DrumRollTick tick;
2017-03-17 18:27:06 +08:00
public DrawableDrumRollTick(DrumRollTick tick)
: base(tick)
{
2017-03-17 18:27:06 +08:00
this.tick = tick;
}
2017-03-23 18:43:00 +08:00
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement();
protected override void CheckJudgement(bool userTriggered)
{
if (!userTriggered)
{
if (Judgement.TimeOffset > tick.HitWindow)
2017-03-20 17:07:44 +08:00
Judgement.Result = HitResult.Miss;
return;
}
if (Math.Abs(Judgement.TimeOffset) < tick.HitWindow)
{
Judgement.Result = HitResult.Hit;
2017-03-22 00:51:44 +08:00
Judgement.TaikoResult = TaikoHitResult.Great;
}
}
2017-03-23 18:43:00 +08:00
protected override void UpdateState(ArmedState state)
{
}
protected override void UpdateScrollPosition(double time)
{
// Drum roll ticks shouldn't move
}
protected override bool HandleKeyPress(Key key)
{
return !Judgement.Result.HasValue && UpdateJudgement(true);
}
}
}