Make Swells play samples while they're being hit

This commit is contained in:
smoogipoo
2017-12-25 15:04:22 +09:00
parent 8529eb1d3a
commit 844e39a9f6
4 changed files with 83 additions and 11 deletions

View File

@ -1,6 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Taiko.Objects
@ -15,5 +20,26 @@ namespace osu.Game.Rulesets.Taiko.Objects
/// The number of hits required to complete the swell successfully.
/// </summary>
public int RequiredHits = 10;
public List<SwellSampleMapping> ProgressionSamples = new List<SwellSampleMapping>();
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
var progressionSamplePoints =
new[] { controlPointInfo.SamplePointAt(StartTime) }
.Concat(controlPointInfo.SamplePoints.Where(p => p.Time > StartTime && p.Time <= EndTime));
foreach (var point in progressionSamplePoints)
{
ProgressionSamples.Add(new SwellSampleMapping
{
Time = point.Time,
Centre = point.GetSampleInfo(),
Rim = point.GetSampleInfo(SampleInfo.HIT_CLAP)
});
}
}
}
}
}