1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Objects/HoldNote.cs

44 lines
1.5 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-09-02 17:44:02 +08:00
2017-05-18 17:19:29 +08:00
using osu.Game.Audio;
2017-05-03 11:53:45 +08:00
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Objects.Types;
2017-04-18 15:05:58 +08:00
namespace osu.Game.Rulesets.Mania.Objects
2016-09-02 17:44:02 +08:00
{
2017-05-09 19:55:20 +08:00
/// <summary>
/// Represents a hit object which requires pressing, holding, and releasing a key.
/// </summary>
2017-05-03 11:53:45 +08:00
public class HoldNote : Note, IHasEndTime
2016-09-02 17:44:02 +08:00
{
2017-05-03 11:53:45 +08:00
/// <summary>
2017-05-09 19:55:20 +08:00
/// Lenience of release hit windows. This is to make cases where the hold note release
/// is timed alongside presses of other hit objects less awkward.
2017-05-03 11:53:45 +08:00
/// </summary>
private const double release_window_lenience = 1.5;
public double Duration { get; set; }
public double EndTime => StartTime + Duration;
2017-05-18 17:19:29 +08:00
/// <summary>
/// The samples to be played when this hold note is released.
/// </summary>
public SampleInfoList EndSamples = new SampleInfoList();
2017-05-09 19:55:20 +08:00
/// <summary>
/// The key-release hit windows for this hold note.
/// </summary>
public HitWindows ReleaseHitWindows { get; protected set; } = new HitWindows();
2017-05-03 11:53:45 +08:00
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
ReleaseHitWindows = HitWindows * release_window_lenience;
}
2016-09-02 17:44:02 +08:00
}
}