1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-24 23:12:54 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.8 KiB
C#
Raw Normal View History

// 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
2022-06-17 15:37:17 +08:00
#nullable disable
2017-08-22 15:46:12 +08:00
using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
2018-04-13 17:19:50 +08:00
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;
2018-04-13 17:19:50 +08:00
/// <summary>
/// The hit object to create the pattern for.
/// </summary>
protected readonly HitObject HitObject;
2018-04-13 17:19:50 +08:00
/// <summary>
/// The beatmap which <see cref="HitObject"/> is a part of.
/// </summary>
protected readonly ManiaBeatmap Beatmap;
2018-04-13 17:19:50 +08:00
protected readonly int TotalColumns;
2018-04-13 17:19:50 +08:00
protected PatternGenerator(HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern)
{
2017-08-22 15:46:12 +08:00
if (hitObject == null) throw new ArgumentNullException(nameof(hitObject));
if (beatmap == null) throw new ArgumentNullException(nameof(beatmap));
if (previousPattern == null) throw new ArgumentNullException(nameof(previousPattern));
2018-04-13 17:19:50 +08:00
HitObject = hitObject;
Beatmap = beatmap;
PreviousPattern = previousPattern;
2018-04-13 17:19:50 +08:00
TotalColumns = Beatmap.TotalColumns;
}
2018-04-13 17:19:50 +08:00
/// <summary>
/// Generates the patterns for <see cref="HitObject"/>, each filled with hit objects.
/// </summary>
/// <returns>The <see cref="Pattern"/>s containing the hit objects.</returns>
public abstract IEnumerable<Pattern> Generate();
}
}