Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "transform" mod #3140

Merged
merged 34 commits into from Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
23a37d0
Implement the arrange mod.
miterosan Jul 30, 2018
4d306ef
Add comments and clean up code.
miterosan Jul 30, 2018
10d444e
Merge branch 'master' into ArrangeMod
miterosan Jul 30, 2018
3457bc0
Merge branch 'master' of https://github.com/ppy/osu into ArrangeMod
miterosan Aug 3, 2018
5bb12b5
The arrange mod is not ranked I think.
miterosan Aug 3, 2018
67c64ac
Put the arrange mod into the fun section.
miterosan Aug 3, 2018
f76b100
Merge branch 'ArrangeMod' of https://github.com/miterosan/osu into Ar…
miterosan Aug 3, 2018
159ce8e
Add license header
miterosan Aug 3, 2018
25791b6
remove space.
miterosan Aug 3, 2018
546bdf0
remove default value init .-.
miterosan Aug 3, 2018
f02d1f9
move the 250 appear disance to a const var.
miterosan Aug 5, 2018
876d410
Add missing ;
miterosan Aug 5, 2018
d32ffc1
Swtich order of the moveto and the movetooffset.
miterosan Aug 5, 2018
7653ce8
add a period after EVERYTHING
miterosan Aug 5, 2018
8ad8c2b
Reset the ScoreMultiplier to 1
miterosan Aug 5, 2018
d1ffb7c
Use timepreempt and put appeartime and move duration into their own v…
miterosan Aug 5, 2018
89a18e4
remove nl and add comment for -1 and +1
miterosan Aug 5, 2018
82054cd
Merge branch 'master' into ArrangeMod
miterosan Aug 14, 2018
d070a3e
Only affect hitcicles, slider and spinner
miterosan Aug 22, 2018
c374755
only affect spinner, hitcircle and slider and nothing else.
miterosan Aug 22, 2018
173d12c
rename arrange to transform
miterosan Aug 22, 2018
5c5191b
Rename the mod class to transform.
miterosan Aug 22, 2018
957a026
Merge branch 'ArrangeMod' of https://github.com/miterosan/osu into Ar…
miterosan Aug 22, 2018
6600f7b
correct the namings and styling
miterosan Aug 22, 2018
0a48f8e
remove empty object ctar args
miterosan Aug 22, 2018
8112a51
Only apply the transformation once and make the distance and theta dy…
miterosan Aug 24, 2018
8b016f0
Remove unessesary nl
miterosan Aug 24, 2018
726a510
remove not needed usings
miterosan Aug 24, 2018
34c42ae
Merge branch 'master' into ArrangeMod
peppy Sep 4, 2018
4c42d40
Correct the comment from explosion to object
miterosan Sep 5, 2018
214fa47
Merge branch 'master' into ArrangeMod
miterosan Sep 5, 2018
da8b838
Merge branch 'master' into ArrangeMod
peppy Sep 14, 2018
14c2aec
Merge remote-tracking branch 'upstream/master' into ArrangeMod
peppy Sep 14, 2018
328de07
Merge branch 'master' into ArrangeMod
peppy Sep 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs
@@ -0,0 +1,51 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using System.Collections.Generic;
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 OsuModTransform : Mod, IApplicableToDrawableHitObjects
{
public override string Name => "Transform";
public override string ShortenedName => "TR";
public override FontAwesome Icon => FontAwesome.fa_arrows;
public override ModType Type => ModType.Fun;
public override string Description => "Everything rotates. EVERYTHING.";
public override double ScoreMultiplier => 1;
private float theta;

public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var drawable in drawables)
{
var hitObject = (OsuHitObject) drawable.HitObject;

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 objects 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;
}
}
}
}
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/OsuRuleset.cs
Expand Up @@ -118,8 +118,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new OsuModAutopilot(),
};
case ModType.Fun:
return new Mod[]
{
return new Mod[] {
new OsuModTransform(),
new OsuModWiggle(),
};
default:
Expand Down