mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 20:02:57 +08:00
Add basic DrawableBash (no graphics yet, just input).
This commit is contained in:
parent
e37def94f8
commit
891bd011c6
79
osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs
Normal file
79
osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
// 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 System.Collections.Generic;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||||
|
{
|
||||||
|
public class DrawableBash : DrawableTaikoHitObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A list of keys which this HitObject will accept. These are the standard Taiko keys for now.
|
||||||
|
/// These should be moved to bindings later.
|
||||||
|
/// </summary>
|
||||||
|
private List<Key> validKeys { get; } = new List<Key>(new[] { Key.D, Key.F, Key.J, Key.K });
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of times the user has hit this bash.
|
||||||
|
/// </summary>
|
||||||
|
private int userHits;
|
||||||
|
|
||||||
|
public DrawableBash(TaikoHitObject hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
|
{
|
||||||
|
if (userTriggered)
|
||||||
|
{
|
||||||
|
if (Time.Current < HitObject.StartTime)
|
||||||
|
return;
|
||||||
|
|
||||||
|
userHits++;
|
||||||
|
|
||||||
|
if (userHits == HitObject.RequiredHits)
|
||||||
|
{
|
||||||
|
Judgement.Result = HitResult.Hit;
|
||||||
|
Judgement.Score = TaikoScoreResult.Great;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Judgement.TimeOffset < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (userHits > HitObject.RequiredHits / 2)
|
||||||
|
{
|
||||||
|
Judgement.Result = HitResult.Hit;
|
||||||
|
Judgement.Score = TaikoScoreResult.Good;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Judgement.Result = HitResult.Miss;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
UpdateScrollPosition(Math.Min(Time.Current, HitObject.StartTime));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
if (Judgement.Result.HasValue)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!validKeys.Contains(args.Key))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UpdateJudgement(true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -51,6 +51,7 @@
|
|||||||
<Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" />
|
<Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" />
|
||||||
<Compile Include="Judgements\TaikoJudgementInfo.cs" />
|
<Compile Include="Judgements\TaikoJudgementInfo.cs" />
|
||||||
<Compile Include="Judgements\TaikoScoreResult.cs" />
|
<Compile Include="Judgements\TaikoScoreResult.cs" />
|
||||||
|
<Compile Include="Objects\Drawable\DrawableBash.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
||||||
<Compile Include="Objects\TaikoHitType.cs" />
|
<Compile Include="Objects\TaikoHitType.cs" />
|
||||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user