Implement the arrange mod.

This commit is contained in:
miterosan 2018-07-30 11:34:20 +02:00
parent 9dc55688d2
commit 23a37d06cf
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Mods
{
internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects
{
public override string Name => "Arrange";
public override string ShortenedName => "Arrange";
public override FontAwesome Icon => FontAwesome.fa_arrows;
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Everything rotates. EVERYTHING";
public override bool Ranked => true;
public override double ScoreMultiplier => 1.05;
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState);
}
private float theta = 0;
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
{
var hitObject = (OsuHitObject) drawable.HitObject;
Vector2 origPos;
if (hitObject is RepeatPoint rp)
{
return;
}
else
{
origPos = drawable.Position;
}
using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - 1000, true))
{
drawable
.MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250)
.MoveTo(origPos, hitObject.TimeFadeIn + 1000, Easing.InOutSine);
}
if (hitObject is HitCircle || hitObject is Slider)
theta += 0.4f;
}
}
}

View File

@ -103,6 +103,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()), new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()),
new OsuModHidden(), new OsuModHidden(),
new OsuModFlashlight(), new OsuModFlashlight(),
new OsuModArrange(),
}; };
case ModType.Special: case ModType.Special:
return new Mod[] return new Mod[]