2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
2018-06-15 21:10:57 +08:00
|
|
|
|
using System.Collections.Generic;
|
2024-03-28 21:32:27 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generator to create a pattern <see cref="Pattern"/> from a hit object.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal abstract class PatternGenerator
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The last pattern.
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected readonly Pattern PreviousPattern;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The hit object to create the pattern for.
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected readonly HitObject HitObject;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The beatmap which <see cref="HitObject"/> is a part of.
|
|
|
|
|
/// </summary>
|
2024-03-28 21:32:27 +08:00
|
|
|
|
protected readonly IBeatmap Beatmap;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
protected readonly int TotalColumns;
|
|
|
|
|
|
2024-03-28 21:32:27 +08:00
|
|
|
|
protected PatternGenerator(HitObject hitObject, IBeatmap beatmap, int totalColumns, Pattern previousPattern)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2022-12-23 04:27:59 +08:00
|
|
|
|
ArgumentNullException.ThrowIfNull(hitObject);
|
|
|
|
|
ArgumentNullException.ThrowIfNull(beatmap);
|
|
|
|
|
ArgumentNullException.ThrowIfNull(previousPattern);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
HitObject = hitObject;
|
|
|
|
|
Beatmap = beatmap;
|
|
|
|
|
PreviousPattern = previousPattern;
|
2024-03-28 21:32:27 +08:00
|
|
|
|
TotalColumns = totalColumns;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-06-15 21:10:57 +08:00
|
|
|
|
/// Generates the patterns for <see cref="HitObject"/>, each filled with hit objects.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
/// </summary>
|
2018-06-15 21:10:57 +08:00
|
|
|
|
/// <returns>The <see cref="Pattern"/>s containing the hit objects.</returns>
|
|
|
|
|
public abstract IEnumerable<Pattern> Generate();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|