1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 21:40:34 +08:00

Add SFX for kiai/star fountain activation

This commit is contained in:
Jamie Taylor 2025-03-01 01:51:37 +09:00
parent c4e37a1566
commit 881534eb7f
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C
2 changed files with 26 additions and 2 deletions

View File

@ -3,6 +3,8 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Graphics.Containers;
@ -14,8 +16,11 @@ namespace osu.Game.Screens.Menu
private StarFountain leftFountain = null!;
private StarFountain rightFountain = null!;
private Sample? sample;
private SampleChannel? sampleChannel;
[BackgroundDependencyLoader]
private void load()
private void load(AudioManager audio)
{
RelativeSizeAxes = Axes.Both;
@ -34,6 +39,8 @@ namespace osu.Game.Screens.Menu
X = -250,
},
};
sample = audio.Samples.Get(@"Gameplay/fountain-shoot");
}
private bool isTriggered;
@ -73,6 +80,11 @@ namespace osu.Game.Screens.Menu
rightFountain.Shoot(1);
break;
}
// Track sample channel to avoid overlapping playback
sampleChannel?.Stop();
sampleChannel = sample?.GetChannel();
sampleChannel?.Play();
}
}
}

View File

@ -3,6 +3,8 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Utils;
@ -19,8 +21,11 @@ namespace osu.Game.Screens.Play
private Bindable<bool> kiaiStarFountains = null!;
private Sample? sample;
private SampleChannel? sampleChannel;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, AudioManager audio)
{
kiaiStarFountains = config.GetBindable<bool>(OsuSetting.StarFountains);
@ -41,6 +46,8 @@ namespace osu.Game.Screens.Play
X = -75,
},
};
sample = audio.Samples.Get(@"Gameplay/fountain-shoot");
}
private bool isTriggered;
@ -66,6 +73,11 @@ namespace osu.Game.Screens.Play
{
leftFountain.Shoot(1);
rightFountain.Shoot(-1);
// Track sample channel to avoid overlapping playback
sampleChannel?.Stop();
sampleChannel = sample?.GetChannel();
sampleChannel?.Play();
}
public partial class GameplayStarFountain : StarFountain