Skip to content

Commit

Permalink
Ensure the player completes most of the notesheet even if they hit th…
Browse files Browse the repository at this point in the history
…e tail
  • Loading branch information
swoolcock committed May 30, 2020
1 parent 0c78ca9 commit 30f2ad1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 8 additions & 3 deletions osu.Game.Rulesets.Rush/Objects/Drawables/DrawableNoteSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Rush.Objects.Drawables
public class DrawableNoteSheet : DrawableLanedHit<NoteSheet>
{
public const float NOTE_SHEET_SIZE = RushPlayfield.HIT_TARGET_SIZE * 0.75f;
public const float REQUIRED_COMPLETION = 0.75f;

public Bindable<bool> HasBroken { get; } = new BindableBool();

Expand All @@ -36,6 +37,7 @@ public class DrawableNoteSheet : DrawableLanedHit<NoteSheet>

public double? HoldStartTime { get; private set; }
public double? HoldEndTime { get; private set; }
public double CompletionAmount => ((HoldEndTime ?? HoldStartTime ?? 0) - (HoldStartTime ?? 0)) / HitObject.Duration;

[Resolved]
private IScrollingInfo scrollingInfo { get; set; }
Expand Down Expand Up @@ -211,17 +213,20 @@ public override void OnReleased(RushAction action)
var tailOffset = Time.Current - Tail.HitObject.StartTime;
tailOffset /= DrawableNoteSheetTail.RELEASE_WINDOW_LENIENCE;

if (!Tail.HitObject.HitWindows.CanBeHit(tailOffset))
if (CompletionAmount < REQUIRED_COMPLETION)
HasBroken.Value = true;
else
else if (Tail.HitObject.HitWindows.CanBeHit(tailOffset))
{
Tail.UpdateResult();
HasBroken.Value = !Tail.IsHit;
}
}

protected override void Update()
{
base.Update();

if (Head.IsHit)
if (Head.IsHit || HasBroken.Value)
holdStar.Show();
else
holdStar.Hide();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Shane Woolcock. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Diagnostics;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Scoring;
Expand All @@ -20,8 +19,6 @@ public DrawableNoteSheetTail(DrawableNoteSheet noteSheet)

protected override void CheckForResult(bool userTriggered, double timeOffset)
{
Debug.Assert(HitObject.HitWindows != null);

// Factor in the release lenience
timeOffset /= RELEASE_WINDOW_LENIENCE;

Expand Down

0 comments on commit 30f2ad1

Please sign in to comment.