From 22fde8d2a0e7ac158358af6839f91c528853d07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 30 Apr 2020 21:58:05 +0200 Subject: [PATCH] Implement partial clear transition logic --- .../Skinning/TestSceneDrawableTaikoMascot.cs | 3 ++- .../UI/DrawableTaikoMascot.cs | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs index cdd2a38e19..f74de47425 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs @@ -201,13 +201,14 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning private void applyNewResult(JudgementResult judgementResult) { + scoreProcessor.ApplyResult(judgementResult); + foreach (var playfield in playfields) { var hit = new DrawableTestHit(new Hit(), judgementResult.Type); Add(hit); playfield.OnNewResult(hit, judgementResult); - scoreProcessor.ApplyResult(judgementResult); } } diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs index f4bc841c15..2df0cae2e3 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.UI { @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Dictionary animations; private TaikoMascotAnimation currentAnimation; - private bool lastHitMissed; + private bool lastObjectHit; private bool kiaiMode; public DrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle) @@ -56,7 +56,18 @@ namespace osu.Game.Rulesets.Taiko.UI public void OnNewResult(JudgementResult result) { - lastHitMissed = result.Type == HitResult.Miss && result.Judgement.AffectsCombo; + // TODO: missing support for clear/fail state transition at end of beatmap gameplay + + if (triggerComboClear(result) || triggerSwellClear(result)) + { + state.Value = TaikoMascotAnimationState.Clear; + return; + } + + if (!result.Judgement.AffectsCombo) + return; + + lastObjectHit = result.IsHit; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) @@ -77,7 +88,7 @@ namespace osu.Game.Rulesets.Taiko.UI if (currentAnimation != null && !currentAnimation.Completed) return state.Value; - if (lastHitMissed) + if (!lastObjectHit) return TaikoMascotAnimationState.Fail; return kiaiMode ? TaikoMascotAnimationState.Kiai : TaikoMascotAnimationState.Idle; @@ -89,5 +100,11 @@ namespace osu.Game.Rulesets.Taiko.UI currentAnimation = animations[state.NewValue]; currentAnimation.Show(); } + + private bool triggerComboClear(JudgementResult judgementResult) + => (judgementResult.ComboAtJudgement + 1) % 50 == 0 && judgementResult.Judgement.AffectsCombo && judgementResult.IsHit; + + private bool triggerSwellClear(JudgementResult judgementResult) + => judgementResult.Judgement is TaikoSwellJudgement && judgementResult.IsHit; } }