mirror of
https://github.com/ppy/osu
synced 2024-12-26 08:53:10 +00:00
Remove late initialization of head + tail, keep them updated with start time and end time.
This commit is contained in:
parent
40e63a0870
commit
c2d3b6c05a
@ -13,20 +13,39 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
/// </summary>
|
||||
public class HoldNote : ManiaHitObject, IHasEndTime
|
||||
{
|
||||
public double Duration { get; set; }
|
||||
public double EndTime => StartTime + Duration;
|
||||
|
||||
private Note head;
|
||||
private double duration;
|
||||
public double Duration
|
||||
{
|
||||
get { return duration; }
|
||||
set
|
||||
{
|
||||
duration = value;
|
||||
Tail.StartTime = EndTime;
|
||||
}
|
||||
}
|
||||
|
||||
public override double StartTime
|
||||
{
|
||||
get { return base.StartTime; }
|
||||
set
|
||||
{
|
||||
base.StartTime = value;
|
||||
Head.StartTime = value;
|
||||
Tail.StartTime = EndTime;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The head note of the hold.
|
||||
/// </summary>
|
||||
public Note Head => head ?? (head = new Note { StartTime = StartTime });
|
||||
public Note Head = new Note();
|
||||
|
||||
private Note tail;
|
||||
/// <summary>
|
||||
/// The tail note of the hold.
|
||||
/// </summary>
|
||||
public Note Tail => tail ?? (tail = new TailNote { StartTime = EndTime });
|
||||
public Note Tail = new TailNote();
|
||||
|
||||
/// <summary>
|
||||
/// The time between ticks of this hold.
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// <summary>
|
||||
/// The time at which the HitObject starts.
|
||||
/// </summary>
|
||||
public double StartTime;
|
||||
public virtual double StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The samples to be played when this hit object is hit.
|
||||
|
Loading…
Reference in New Issue
Block a user