1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

ArmedState now considered, SliderBody now deflates (TODO: handle slider's nested objects)

This commit is contained in:
MaxOhn 2018-10-10 01:36:37 +02:00
parent 0ae9c78c38
commit 951ac30de8

View File

@ -7,6 +7,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using System.Collections.Generic;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Mods
{
@ -27,19 +28,53 @@ namespace osu.Game.Rulesets.Osu.Mods
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
{
if (!(drawable is DrawableHitCircle d))
if (!(drawable is DrawableOsuHitObject d))
return;
d.ApproachCircle.Hide();
var h = d.HitObject;
using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
switch (drawable)
{
var origScale = d.Scale;
d.ScaleTo(1.1f, 1) // if duration = 0 then components (i.e. flash) scale with it -> we don't want that
.Then()
.ScaleTo(origScale, h.TimePreempt)
.Then()
.FadeOut(800)
.ScaleTo(d.Scale * 1.5f, 400, Easing.OutQuad); // reapply overwritten ScaleTo
case DrawableHitCircle c:
c.ApproachCircle.Hide();
using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
{
var origScale = d.Scale;
d.ScaleTo(1.1f, 1)
.Then()
.ScaleTo(origScale, h.TimePreempt);
}
switch (state)
{
case ArmedState.Miss:
d.FadeOut(100);
break;
case ArmedState.Hit:
d.FadeOut(800)
.ScaleTo(d.Scale * 1.5f, 400, Easing.OutQuad);
break;
}
break;
case DrawableSlider s:
using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt + 1, true))
{
float origPathWidth = s.Body.PathWidth;
var origBodySize = s.Body.Size;
var origBodyDrawPos = s.Body.DrawPosition;
s.Body.MoveTo(origBodyDrawPos - new Vector2(origPathWidth), 1)
.Then()
.MoveTo(origBodyDrawPos, h.TimePreempt);
s.Body.ResizeTo(origBodySize * 2, 1)
.Then()
.ResizeTo(origBodySize, h.TimePreempt);
s.Body.TransformTo("PathWidth", origPathWidth * 2, 1)
.Then()
.TransformTo("PathWidth", origPathWidth, h.TimePreempt);
}
break;
}
}
}