// Copyright (c) ppy Pty Ltd . 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 { /// /// Wraps a and provides additional information to be used for difficulty calculation. /// public class DifficultyHitObject { private readonly List difficultyHitObjects; /// /// The position of this in the list. /// public int Position; /// /// The this wraps. /// public readonly HitObject BaseObject; /// /// The last which occurs before . /// public readonly HitObject LastObject; /// /// Amount of time elapsed between and , adjusted by clockrate. /// public readonly double DeltaTime; /// /// Clockrate adjusted start time of . /// public readonly double StartTime; /// /// Clockrate adjusted end time of . /// public readonly double EndTime; /// /// Creates a new . /// /// The which this wraps. /// The last which occurs before in the beatmap. /// The rate at which the gameplay clock is run at. /// The list of s in the current beatmap. /// The position of this in the list. public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List 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)]; } }