Merge pull request #10961 from smoogipoo/better-dho-rewind

Rewind pooled DHOs into better states
This commit is contained in:
Dean Herbert
2020-11-27 00:42:58 +09:00
committed by GitHub
3 changed files with 27 additions and 11 deletions

View File

@ -128,6 +128,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
private readonly Bindable<ArmedState> state = new Bindable<ArmedState>();
/// <summary>
/// The state of this <see cref="DrawableHitObject"/>.
/// </summary>
/// <remarks>
/// For pooled hitobjects, <see cref="ApplyCustomUpdateState"/> is recommended to be used instead for better editor/rewinding support.
/// </remarks>
public IBindable<ArmedState> State => state;
/// <summary>
@ -259,7 +265,17 @@ namespace osu.Game.Rulesets.Objects.Drawables
// If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
if (IsLoaded)
Schedule(() => updateState(ArmedState.Idle, true));
{
Scheduler.Add(() =>
{
if (Result.IsHit)
updateState(ArmedState.Hit, true);
else if (Result.HasResult)
updateState(ArmedState.Miss, true);
else
updateState(ArmedState.Idle, true);
});
}
hasHitObjectApplied = true;
}