Centralise End/StartTime retrieval to extension method

This commit is contained in:
Dean Herbert
2019-11-25 19:01:24 +09:00
parent 5e8f3eb28f
commit 709ec1404f
19 changed files with 47 additions and 42 deletions

View File

@ -4,7 +4,6 @@
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Screens.Play
@ -26,7 +25,7 @@ namespace osu.Game.Screens.Play
return;
var firstHit = objects.First().StartTime;
var lastHit = objects.Max(o => (o as IHasEndTime)?.EndTime ?? o.StartTime);
var lastHit = objects.Max(o => (o.GetEndTime()));
if (lastHit == 0)
lastHit = objects.Last().StartTime;
@ -35,7 +34,7 @@ namespace osu.Game.Screens.Play
foreach (var h in objects)
{
var endTime = (h as IHasEndTime)?.EndTime ?? h.StartTime;
var endTime = h.GetEndTime();
Debug.Assert(endTime >= h.StartTime);