osu/osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.3 KiB
C#
Raw Normal View History

2019-12-21 12:47:34 +00: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;
2021-06-04 04:50:12 +00:00
using osu.Framework.Audio.Track;
2019-12-21 12:47:34 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
2021-06-04 04:50:12 +00:00
using osu.Game.Beatmaps.ControlPoints;
2019-12-21 12:47:34 +00:00
using osu.Game.Graphics.Containers;
using osuTK.Graphics;
2019-12-21 12:47:34 +00:00
2021-06-04 04:50:12 +00:00
namespace osu.Game.Rulesets.Osu.Skinning.Default
2019-12-21 12:47:34 +00:00
{
public partial class KiaiFlash : BeatSyncedContainer
{
2021-06-04 05:06:08 +00:00
private const double fade_length = 80;
private const float flash_opacity = 0.25f;
2019-12-21 12:53:02 +00:00
2019-12-21 12:47:34 +00:00
public KiaiFlash()
{
2019-12-21 14:44:52 +00:00
EarlyActivationMilliseconds = 80;
2019-12-21 12:47:34 +00:00
Blending = BlendingParameters.Additive;
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
Alpha = 0f,
};
2019-12-21 12:47:34 +00:00
}
2021-06-04 04:50:12 +00:00
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
2019-12-21 12:47:34 +00:00
{
if (!effectPoint.KiaiMode)
return;
Child
2021-06-04 05:06:08 +00:00
.FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint)
.Then()
.FadeOut(Math.Max(fade_length, timingPoint.BeatLength - fade_length), Easing.OutSine);
2019-12-21 12:47:34 +00:00
}
}
}