1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 13:27:23 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs

51 lines
1.9 KiB
C#
Raw Normal View History

2019-01-31 17:03:43 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
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 osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Mods
{
internal class OsuModGrow : Mod, IApplicableToDrawableHitObjects
{
public override string Name => "Grow";
public override string Acronym => "GR";
public override FontAwesome Icon => FontAwesome.fa_arrows_v;
public override ModType Type => ModType.Fun;
public override string Description => "Hit them at the right size!";
public override double ScoreMultiplier => 1;
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var drawable in drawables)
{
if (drawable is DrawableSpinner spinner)
return;
drawable.ApplyCustomUpdateState += applyCustomState;
}
}
protected virtual void applyCustomState(DrawableHitObject drawable, ArmedState state)
2019-01-31 17:58:09 +08:00
{
2019-01-31 17:03:43 +08:00
var hitObject = (OsuHitObject) drawable.HitObject;
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
double scaleDuration = hitObject.TimePreempt + 1;
var originalScale = drawable.Scale;
drawable.Scale /= 2;
using (drawable.BeginAbsoluteSequence(appearTime, true))
drawable.ScaleTo(originalScale, scaleDuration, Easing.OutSine);
if (drawable is DrawableHitCircle circle)
using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
circle.ApproachCircle.Hide();
}
}
}