1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Only affect hitcicles, slider and spinner

This commit is contained in:
miterosan 2018-08-22 20:46:03 +02:00
parent 89a18e4aac
commit d070a3e2d8

View File

@ -24,7 +24,13 @@ namespace osu.Game.Rulesets.Osu.Mods
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{ {
drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); drawables.Where(drawable => (
drawable is DrawableHitCircle ||
drawable is DrawableSlider ||
drawable is DrawableSpinner
)).ForEach(drawable =>
drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState
);
} }
private float theta; private float theta;
@ -33,13 +39,10 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
var hitObject = (OsuHitObject) drawable.HitObject; var hitObject = (OsuHitObject) drawable.HitObject;
// repeat points get their position data from the slider. float appear_distance = (float)hitObject.TimePreempt * 0.5f;
if (hitObject is RepeatPoint)
return;
Vector2 originalPosition = drawable.Position; Vector2 originalPosition = drawable.Position;
Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance;
const float appear_distance = 250;
//the - 1 and + 1 prevents the hit explosion to appear in the wrong position. //the - 1 and + 1 prevents the hit explosion to appear in the wrong position.
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
@ -48,13 +51,11 @@ namespace osu.Game.Rulesets.Osu.Mods
using (drawable.BeginAbsoluteSequence(appearTime, true)) using (drawable.BeginAbsoluteSequence(appearTime, true))
{ {
drawable drawable
.MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) .MoveToOffset(appearOffset)
.MoveTo(originalPosition, moveDuration, Easing.InOutSine); .MoveTo(originalPosition, moveDuration, Easing.InOutSine);
} }
// That way slider ticks come all from the same direction. theta += 0.4f;
if (hitObject is HitCircle || hitObject is Slider)
theta += 0.4f;
} }
} }
} }