Store hitobject history in the hitobject

This commit is contained in:
apollo-dw
2022-05-22 16:26:22 +01:00
parent d84119ac06
commit 26985ca8af
19 changed files with 94 additions and 88 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Difficulty.Preprocessing
@ -10,6 +11,13 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
/// </summary>
public class DifficultyHitObject
{
private readonly List<DifficultyHitObject> difficultyHitObjects;
/// <summary>
/// The position of this <see cref="DifficultyHitObject"/> in the <see cref="difficultyHitObjects"/> list.
/// </summary>
public int Position;
/// <summary>
/// The <see cref="HitObject"/> this <see cref="DifficultyHitObject"/> wraps.
/// </summary>
@ -41,13 +49,21 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
/// <param name="hitObject">The <see cref="HitObject"/> which this <see cref="DifficultyHitObject"/> wraps.</param>
/// <param name="lastObject">The last <see cref="HitObject"/> which occurs before <paramref name="hitObject"/> in the beatmap.</param>
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)
/// <param name="objects">The list of <see cref="DifficultyHitObject"/>s in the current beatmap.</param>
/// <param name="position">The position of this <see cref="DifficultyHitObject"/> in the <see cref="difficultyHitObjects"/> list.</param>
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position)
{
difficultyHitObjects = objects;
Position = position;
BaseObject = hitObject;
LastObject = lastObject;
DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate;
StartTime = hitObject.StartTime / clockRate;
EndTime = hitObject.GetEndTime() / clockRate;
}
public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects[Position - (backwardsIndex + 1)];
public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects[Position + (forwardsIndex + 1)];
}
}