mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Create ZoomIn Mod
This commit is contained in:
parent
492b5edb02
commit
dbc2eb4771
55
osu.Game.Rulesets.Osu/Mods/OsuModZoomIn.cs
Normal file
55
osu.Game.Rulesets.Osu/Mods/OsuModZoomIn.cs
Normal file
@ -0,0 +1,55 @@
|
||||
// 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.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;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public class OsuModZoomIn : Mod, IApplicableToDrawableHitObjects
|
||||
{
|
||||
public override string Name => "Zoom In";
|
||||
public override string ShortenedName => "ZI";
|
||||
public override FontAwesome Icon => FontAwesome.fa_dot_circle_o;
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "Circles zoom in. No approach circles.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||
{
|
||||
foreach (var drawable in drawables)
|
||||
{
|
||||
drawable.ApplyCustomUpdateState += ApplyBounceState;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ApplyBounceState(DrawableHitObject drawable, ArmedState state)
|
||||
{
|
||||
if (!(drawable is DrawableOsuHitObject d))
|
||||
return;
|
||||
|
||||
var h = (OsuHitObject)drawable.HitObject;
|
||||
|
||||
double appearTime = h.StartTime - h.TimePreempt;
|
||||
double moveDuration = h.TimePreempt;
|
||||
|
||||
using (drawable.BeginAbsoluteSequence(appearTime, true))
|
||||
{
|
||||
var origScale = drawable.Scale;
|
||||
|
||||
drawable
|
||||
.ScaleTo(0.0f)
|
||||
.ScaleTo(origScale, moveDuration, Easing.InOutSine);
|
||||
}
|
||||
|
||||
// Hide approach circle
|
||||
(drawable as DrawableHitCircle)?.ApproachCircle.Hide();
|
||||
}
|
||||
}
|
||||
}
|
@ -121,6 +121,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
return new Mod[] {
|
||||
new OsuModTransform(),
|
||||
new OsuModWiggle(),
|
||||
new OsuModZoomIn(),
|
||||
};
|
||||
default:
|
||||
return new Mod[] { };
|
||||
|
Loading…
Reference in New Issue
Block a user