Introduce StartFrame and EndFrame to simplify the replay interpolation code

This commit is contained in:
ekrctb
2021-04-16 12:53:58 +09:00
parent 84bc81a6de
commit 91c7d8d26c
5 changed files with 33 additions and 72 deletions

View File

@ -19,27 +19,14 @@ namespace osu.Game.Rulesets.Catch.Replays
protected override bool IsImportant(CatchReplayFrame frame) => frame.Actions.Any();
protected float? Position
{
get
{
var frame = CurrentFrame;
if (frame == null)
return null;
return NextFrame != null ? Interpolation.ValueAt(CurrentTime, frame.Position, NextFrame.Position, frame.Time, NextFrame.Time) : frame.Position;
}
}
public override void CollectPendingInputs(List<IInput> inputs)
{
if (!Position.HasValue) return;
var position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
inputs.Add(new CatchReplayState
{
PressedActions = CurrentFrame?.Actions ?? new List<CatchAction>(),
CatcherX = Position.Value
CatcherX = position
});
}