mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Merge pull request #14997 from peppy/move-low-pass-on-fail-to-fail-animation
Move low pass fail effect to `FailAnimation`
This commit is contained in:
commit
092bdfb6a3
@ -10,7 +10,9 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osuTK;
|
||||
@ -22,7 +24,7 @@ namespace osu.Game.Screens.Play
|
||||
/// Manage the animation to be applied when a player fails.
|
||||
/// Single file; automatically disposed after use.
|
||||
/// </summary>
|
||||
public class FailAnimation : Component
|
||||
public class FailAnimation : CompositeDrawable
|
||||
{
|
||||
public Action OnComplete;
|
||||
|
||||
@ -32,6 +34,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private Track track;
|
||||
|
||||
private AudioFilter failLowPassFilter;
|
||||
|
||||
private const float duration = 2500;
|
||||
|
||||
private Sample failSample;
|
||||
@ -46,6 +50,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
track = beatmap.Value.Track;
|
||||
failSample = audio.Samples.Get(@"Gameplay/failsound");
|
||||
|
||||
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
|
||||
}
|
||||
|
||||
private bool started;
|
||||
@ -68,6 +74,8 @@ namespace osu.Game.Screens.Play
|
||||
Expire();
|
||||
});
|
||||
|
||||
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
|
||||
|
||||
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
|
||||
|
||||
applyToPlayfield(drawableRuleset.Playfield);
|
||||
|
@ -15,7 +15,6 @@ using osu.Framework.Input.Events;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -215,7 +214,6 @@ namespace osu.Game.Screens.Play
|
||||
InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);
|
||||
|
||||
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
|
||||
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
|
||||
|
||||
Score = CreateScore(playableBeatmap);
|
||||
|
||||
@ -770,8 +768,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private FailAnimation failAnimation;
|
||||
|
||||
private AudioFilter failLowPassFilter;
|
||||
|
||||
private bool onFail()
|
||||
{
|
||||
if (!CheckModsAllowFailure())
|
||||
@ -786,7 +782,6 @@ namespace osu.Game.Screens.Play
|
||||
if (PauseOverlay.State.Value == Visibility.Visible)
|
||||
PauseOverlay.Hide();
|
||||
|
||||
failLowPassFilter.CutoffTo(300, 2500, Easing.OutCubic);
|
||||
failAnimation.Start();
|
||||
|
||||
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
||||
@ -799,7 +794,6 @@ namespace osu.Game.Screens.Play
|
||||
private void onFailComplete()
|
||||
{
|
||||
GameplayClockContainer.Stop();
|
||||
failLowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
|
||||
|
||||
FailOverlay.Retries = RestartCount;
|
||||
FailOverlay.Show();
|
||||
|
Loading…
Reference in New Issue
Block a user