mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 01:47:45 +08:00
Add SFX for kiai/star fountain activation
This commit is contained in:
parent
c4e37a1566
commit
881534eb7f
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user