2017-06-02 17:20:14 +08:00
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
2017-06-02 16:33:58 +08:00
|
|
|
using System.Collections.Generic;
|
2017-09-11 13:48:01 +08:00
|
|
|
using System.Linq;
|
2017-06-02 16:33:58 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2017-06-02 16:43:24 +08:00
|
|
|
using osu.Game.Graphics;
|
2017-06-09 01:43:48 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Timing;
|
2017-06-02 19:17:44 +08:00
|
|
|
using osu.Game.Rulesets.Timing;
|
2017-06-02 16:33:58 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Mods
|
|
|
|
{
|
2017-06-09 18:57:03 +08:00
|
|
|
public class ManiaModGravity : Mod, IGenerateSpeedAdjustments
|
2017-06-02 16:33:58 +08:00
|
|
|
{
|
|
|
|
public override string Name => "Gravity";
|
2017-08-13 23:41:13 +08:00
|
|
|
public override string ShortenedName => "GR";
|
2017-06-02 16:33:58 +08:00
|
|
|
|
|
|
|
public override double ScoreMultiplier => 0;
|
|
|
|
|
2017-06-02 16:43:24 +08:00
|
|
|
public override FontAwesome Icon => FontAwesome.fa_sort_desc;
|
|
|
|
|
2017-08-09 12:28:29 +08:00
|
|
|
public void ApplyToRulesetContainer(ManiaRulesetContainer rulesetContainer, ref List<SpeedAdjustmentContainer>[] hitObjectTimingChanges, ref List<SpeedAdjustmentContainer> barlineTimingChanges)
|
2017-06-02 16:33:58 +08:00
|
|
|
{
|
2017-06-12 14:20:34 +08:00
|
|
|
// We have to generate one speed adjustment per hit object for gravity
|
2017-09-11 13:48:01 +08:00
|
|
|
foreach (ManiaHitObject obj in rulesetContainer.Objects.OfType<ManiaHitObject>())
|
2017-06-02 16:33:58 +08:00
|
|
|
{
|
2017-08-09 12:28:29 +08:00
|
|
|
MultiplierControlPoint controlPoint = rulesetContainer.CreateControlPointAt(obj.StartTime);
|
2017-06-12 14:20:34 +08:00
|
|
|
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
|
2017-06-09 18:57:03 +08:00
|
|
|
controlPoint.TimingPoint.BeatLength = 1000;
|
2017-06-02 16:33:58 +08:00
|
|
|
|
2017-06-12 14:20:34 +08:00
|
|
|
hitObjectTimingChanges[obj.Column].Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
2017-06-09 18:57:03 +08:00
|
|
|
}
|
2017-06-02 16:33:58 +08:00
|
|
|
|
2017-06-12 14:20:34 +08:00
|
|
|
// Like with hit objects, we need to generate one speed adjustment per bar line
|
2017-12-28 21:40:23 +08:00
|
|
|
foreach (BarLine barLine in rulesetContainer.BarLines)
|
2017-06-02 16:33:58 +08:00
|
|
|
{
|
2017-12-28 21:40:23 +08:00
|
|
|
var controlPoint = rulesetContainer.CreateControlPointAt(barLine.StartTime);
|
2017-06-12 14:20:34 +08:00
|
|
|
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
|
2017-06-09 18:57:03 +08:00
|
|
|
controlPoint.TimingPoint.BeatLength = 1000;
|
2017-06-02 16:33:58 +08:00
|
|
|
|
2017-06-09 18:57:03 +08:00
|
|
|
barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
|
2017-06-02 16:33:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-12-28 21:40:23 +08:00
|
|
|
}
|