1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-26 04:32:55 +08:00
osu-lazer/osu.Game/Rulesets/Judgements/Judgement.cs

71 lines
2.5 KiB
C#
Raw Normal View History

2017-03-15 20:32:47 +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
2017-04-18 15:05:58 +08:00
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
2017-04-18 15:05:58 +08:00
namespace osu.Game.Rulesets.Judgements
{
2017-09-05 18:44:59 +08:00
public class Judgement
{
/// <summary>
/// Whether this judgement is the result of a hit or a miss.
/// </summary>
public HitResult Result;
2017-09-05 18:44:59 +08:00
/// <summary>
/// The maximum <see cref="HitResult"/> that can be achieved.
/// </summary>
public virtual HitResult MaxResult => HitResult.Perfect;
/// <summary>
/// The combo prior to this judgement occurring.
/// </summary>
public int ComboAtJudgement;
/// <summary>
/// The highest combo achieved prior to this judgement occurring.
/// </summary>
public int HighestComboAtJudgement;
/// <summary>
/// Whether a successful hit occurred.
/// </summary>
2017-09-05 18:44:59 +08:00
public bool IsHit => Result > HitResult.Miss;
/// <summary>
/// Whether this judgement is the final judgement for the hit object.
/// </summary>
public bool Final = true;
/// <summary>
/// The offset from a perfect hit at which this judgement occurred.
2017-09-12 16:36:46 +08:00
/// Populated when added via <see cref="DrawableHitObject{TObject}.AddJudgement"/>.
/// </summary>
2017-11-21 11:11:29 +08:00
public double TimeOffset { get; set; }
/// <summary>
/// Whether the <see cref="Result"/> should affect the combo portion of the score.
/// If false, the <see cref="Result"/> will be considered for the bonus portion of the score.
/// </summary>
public virtual bool AffectsCombo => true;
/// <summary>
2017-09-05 18:44:59 +08:00
/// The numeric representation for the result achieved.
/// </summary>
public int NumericResult => NumericResultFor(Result);
/// <summary>
/// The numeric representation for the maximum achievable result.
/// </summary>
2017-09-05 18:44:59 +08:00
public int MaxNumericResult => NumericResultFor(MaxResult);
/// <summary>
2017-09-05 18:44:59 +08:00
/// Convert a <see cref="HitResult"/> to a numeric score representation.
/// </summary>
2017-09-05 18:44:59 +08:00
/// <param name="result">The value to convert.</param>
/// <returns>The number.</returns>
protected virtual int NumericResultFor(HitResult result) => result > HitResult.Miss ? 1 : 0;
}
}