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.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using System.Collections.Generic; using System.Collections.Generic;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
@ -27,19 +28,53 @@ namespace osu.Game.Rulesets.Osu.Mods
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
{ {
if (!(drawable is DrawableHitCircle d)) if (!(drawable is DrawableOsuHitObject d))
return; return;
d.ApproachCircle.Hide();
var h = d.HitObject; var h = d.HitObject;
using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
switch (drawable)
{ {
var origScale = d.Scale; case DrawableHitCircle c:
d.ScaleTo(1.1f, 1) // if duration = 0 then components (i.e. flash) scale with it -> we don't want that c.ApproachCircle.Hide();
.Then() using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
.ScaleTo(origScale, h.TimePreempt) {
.Then() var origScale = d.Scale;
.FadeOut(800) d.ScaleTo(1.1f, 1)
.ScaleTo(d.Scale * 1.5f, 400, Easing.OutQuad); // reapply overwritten ScaleTo .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;
} }
} }
} }