mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Remove late initialization of head + tail, keep them updated with start time and end time.
This commit is contained in:
@ -13,20 +13,39 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class HoldNote : ManiaHitObject, IHasEndTime
|
public class HoldNote : ManiaHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double Duration { get; set; }
|
|
||||||
public double EndTime => StartTime + Duration;
|
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>
|
/// <summary>
|
||||||
/// The head note of the hold.
|
/// The head note of the hold.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Note Head => head ?? (head = new Note { StartTime = StartTime });
|
public Note Head = new Note();
|
||||||
|
|
||||||
private Note tail;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The tail note of the hold.
|
/// The tail note of the hold.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Note Tail => tail ?? (tail = new TailNote { StartTime = EndTime });
|
public Note Tail = new TailNote();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time between ticks of this hold.
|
/// The time between ticks of this hold.
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time at which the HitObject starts.
|
/// The time at which the HitObject starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double StartTime;
|
public virtual double StartTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The samples to be played when this hit object is hit.
|
/// The samples to be played when this hit object is hit.
|
||||||
|
Reference in New Issue
Block a user