Merge pull request #17159 from smoogipoo/add-hitresult-helper

Add IsBasic() and IsTick() extensions on HitResult
This commit is contained in:
Dean Herbert 2022-03-08 18:46:39 +09:00 committed by GitHub
commit e0dc3a04f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,6 +133,30 @@ namespace osu.Game.Rulesets.Scoring
public static bool AffectsAccuracy(this HitResult result)
=> IsScorable(result) && !IsBonus(result);
/// <summary>
/// Whether a <see cref="HitResult"/> is a non-tick and non-bonus result.
/// </summary>
public static bool IsBasic(this HitResult result)
=> IsScorable(result) && !IsTick(result) && !IsBonus(result);
/// <summary>
/// Whether a <see cref="HitResult"/> should be counted as a tick.
/// </summary>
public static bool IsTick(this HitResult result)
{
switch (result)
{
case HitResult.LargeTickHit:
case HitResult.LargeTickMiss:
case HitResult.SmallTickHit:
case HitResult.SmallTickMiss:
return true;
default:
return false;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> should be counted as bonus score.
/// </summary>