From 8112a51d5fc1b2e9c4d51c7224562377d7e71f04 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:23:27 +0200 Subject: [PATCH] Only apply the transformation once and make the distance and theta dynamic. --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 59 ++++++++----------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index e31c7b12f9..e76da68bee 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -22,46 +22,35 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - - private readonly IReadOnlyList targetHitObjectTypes = new List { - typeof(HitCircle), - typeof(Slider), - typeof(Spinner), - }; + private float theta; public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => - drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState - ); - } - - private float theta; - - private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) - { - var hitObject = (OsuHitObject) drawable.HitObject; - - if (!targetHitObjectTypes.Contains(hitObject.GetType())) - return; - - float appearDistance = (float)hitObject.TimePreempt * 0.5f; - - Vector2 originalPosition = drawable.Position; - Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; - - //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. - double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; - double moveDuration = hitObject.TimePreempt + 1; - - using (drawable.BeginAbsoluteSequence(appearTime, true)) + foreach (var drawable in drawables) { - drawable - .MoveToOffset(appearOffset) - .MoveTo(originalPosition, moveDuration, Easing.InOutSine); - } + var hitObject = (OsuHitObject) drawable.HitObject; - theta += 0.4f; + float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2; + + Vector2 originalPosition = drawable.Position; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; + + //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. + double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; + double moveDuration = hitObject.TimePreempt + 1; + + using (drawable.BeginAbsoluteSequence(appearTime, true)) + { + drawable + .MoveToOffset(appearOffset) + .MoveTo(originalPosition, moveDuration, Easing.InOutSine); + } + + theta += (float) hitObject.TimeFadeIn / 1000; + } } + + + } }