1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 12:12:54 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Mods/ManiaModGravity.cs

46 lines
2.1 KiB
C#
Raw Normal View History

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;
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;
using osu.Game.Rulesets.Mania.Timing;
using osu.Game.Rulesets.Timing;
2017-06-09 21:03:28 +08:00
using osu.Game.Rulesets.Mania.Objects.Drawables;
2017-06-02 16:33:58 +08:00
namespace osu.Game.Rulesets.Mania.Mods
{
public class ManiaModGravity : Mod, IGenerateSpeedAdjustments
2017-06-02 16:33:58 +08:00
{
public override string Name => "Gravity";
public override double ScoreMultiplier => 0;
2017-06-02 16:43:24 +08:00
public override FontAwesome Icon => FontAwesome.fa_sort_desc;
public void ApplyToHitRenderer(ManiaHitRenderer hitRenderer, ref List<SpeedAdjustmentContainer>[] hitObjectTimingChanges, ref List<SpeedAdjustmentContainer> barlineTimingChanges)
2017-06-02 16:33:58 +08:00
{
// We have to generate one speed adjustment per hit object for gravity
foreach (ManiaHitObject obj in hitRenderer.Objects)
2017-06-02 16:33:58 +08:00
{
MultiplierControlPoint controlPoint = hitRenderer.CreateControlPointAt(obj.StartTime);
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
controlPoint.TimingPoint.BeatLength = 1000;
2017-06-02 16:33:58 +08:00
hitObjectTimingChanges[obj.Column].Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
}
2017-06-02 16:33:58 +08:00
// Like with hit objects, we need to generate one speed adjustment per bar line
2017-06-09 21:03:28 +08:00
foreach (DrawableBarLine barLine in hitRenderer.BarLines)
2017-06-02 16:33:58 +08:00
{
2017-06-09 21:03:28 +08:00
var controlPoint = hitRenderer.CreateControlPointAt(barLine.HitObject.StartTime);
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
controlPoint.TimingPoint.BeatLength = 1000;
2017-06-02 16:33:58 +08:00
barlineTimingChanges.Add(new ManiaSpeedAdjustmentContainer(controlPoint, ScrollingAlgorithm.Gravity));
2017-06-02 16:33:58 +08:00
}
}
}
}