Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2194 from smoogipoo/drawableslider-cleanup
Split out the slider head into a separate drawable hitobject
- Loading branch information
Showing
4 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. | ||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE | ||
|
||
using osu.Game.Rulesets.Objects.Types; | ||
using OpenTK; | ||
|
||
namespace osu.Game.Rulesets.Osu.Objects.Drawables | ||
{ | ||
public class DrawableSliderHead : DrawableHitCircle | ||
{ | ||
private readonly Slider slider; | ||
|
||
public DrawableSliderHead(Slider slider, HitCircle h) | ||
: base(h) | ||
{ | ||
this.slider = slider; | ||
|
||
Position = HitObject.Position - slider.Position; | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
|
||
double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); | ||
|
||
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. | ||
if (!IsHit) | ||
Position = slider.CurvePositionAt(completionProgress); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters