1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 09:37:42 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs

51 lines
1.8 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
2019-06-28 16:34:04 +08:00
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects.Drawables;
2018-04-13 17:19:50 +08:00
using osu.Game.Rulesets.Mods;
2019-06-28 16:34:04 +08:00
using osu.Game.Rulesets.Objects.Drawables;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Rulesets.Catch.Mods
{
public class CatchModHidden : ModHidden
{
public override string Description => @"Play with fading fruits.";
public override double ScoreMultiplier => 1.06;
2019-06-28 16:34:04 +08:00
private const double fade_out_offset_multiplier = 0.6;
private const double fade_out_duration_multiplier = 0.44;
2020-11-05 14:36:44 +08:00
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
2019-06-28 16:34:04 +08:00
{
2020-11-05 14:36:44 +08:00
base.ApplyNormalVisibilityState(hitObject, state);
if (!(hitObject is DrawableCatchHitObject catchDrawable))
2019-06-28 16:34:04 +08:00
return;
if (catchDrawable.NestedHitObjects.Any())
{
foreach (var nestedDrawable in catchDrawable.NestedHitObjects)
{
if (nestedDrawable is DrawableCatchHitObject nestedCatchDrawable)
fadeOutHitObject(nestedCatchDrawable);
}
}
else
fadeOutHitObject(catchDrawable);
}
private void fadeOutHitObject(DrawableCatchHitObject drawable)
{
var hitObject = drawable.HitObject;
var offset = hitObject.TimePreempt * fade_out_offset_multiplier;
var duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier;
using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset, true))
drawable.FadeOut(duration);
}
2018-04-13 17:19:50 +08:00
}
}